{
"candidates": [
{
"content": {
"parts": [
{
"text": "```yaml\n---\ndescription: Route for updating a project by name. Reads project settings from JSON, updates YAML files, and redirects to the root.\n\nimports:\n - module: actix_web\n description: Framework for building web applications.\n items:\n - get\n - web\n - HttpResponse\n - Responder\n - module: crate::models\n description: Application models.\n items:\n - AppState\n - Project\n - module: crate::services::yaml_service\n description: Service for handling YAML file operations.\n items:\n - YamlService\n - module: std::fs\n description: Standard library for file system operations.\n items:\n - read_to_string\n - module: std::path\n description: Standard library for path manipulation.\n items:\n - Path\n\nfunctions:\n - name: update_project\n parameters:\n - name: app_state\n type: web::Data\u003cAppState\u003e\n description: Application state containing configuration information.\n - name: name\n type: web::Path\u003cString\u003e\n description: The name of the project to update.\n return_type: impl Responder\n description: |\n Updates a project by reading its settings from a JSON file,\n saving the settings to YAML files using YamlService, and\n redirecting the user to the root page. Returns an HTTP response\n indicating success or failure.\n logic:\n - step: Extract project name from path.\n - step: Construct the path to the project settings JSON file.\n - step: Attempt to read the contents of the JSON file.\n success:\n - step: Deserialize the JSON into a Project object.\n success:\n - step: Create a new YamlService instance.\n - step: Save the project settings as YAML files to the output directory.\n - step: Return a \"See Other\" (303) HTTP response, redirecting to the root (\"/\").\n failure:\n - step: Return an \"Internal Server Error\" (500) HTTP response with an error message.\n failure:\n - step: Return a \"Not Found\" (404) HTTP response with an error message.\n```"
}
],
"role": "model"
},
"finishReason": "STOP",
"avgLogprobs": -0.12361284214599128
}
],
"usageMetadata": {
"promptTokenCount": 1199,
"candidatesTokenCount": 507,
"totalTokenCount": 1706,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 1199
}
],
"candidatesTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 507
}
]
},
"modelVersion": "gemini-2.0-flash"
}