Commit 0c1c2429 authored by Your Name's avatar Your Name

Fix UnboundLocalError: template_manager not defined

When 'raw' is used without 'prompt', template_manager wasn't defined.
Now creating it on-demand when needed.
parent ca6f9841
......@@ -2123,6 +2123,11 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request
# Check if we need to set up raw mode (if not already done in prompt handling)
if "raw" in force_reasoning_args and not use_raw_mode:
# Create template_manager if not already created
if 'template_manager' not in locals():
from codai.models.templates import AgenticTemplateManager
template_manager = AgenticTemplateManager(request.model)
# Use template_manager.format_for_raw_completion which handles everything
if hasattr(template_manager, 'format_for_raw_completion'):
# Extract system and user messages
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment