From e8d9eda61a204ce67a73f86e190208853a3660ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= <78488229+viktor138irk@users.noreply.github.com> Date: Mon, 11 May 2026 22:23:16 +0900 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20auto=20model=20routing=20=D0=B2=20prompt=20sandbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index be9c1a4..d292b25 100644 --- a/backend/main.py +++ b/backend/main.py @@ -37,6 +37,7 @@ class OpenAIConfigRequest(BaseModel): class PromptTestRequest(BaseModel): prompt: str + task_type: str | None = None @app.get('/') @@ -105,26 +106,26 @@ async def test_prompt(payload: PromptTestRequest): raise HTTPException(status_code=400, detail='Prompt is empty') try: - answer = await ask_ai(prompt) + result = await ask_ai(prompt, payload.task_type) except OpenAIConfigurationError as exc: raise HTTPException(status_code=400, detail=str(exc)) from exc return { 'success': True, - 'model': get_openai_model(), - 'answer': answer, + 'model': result['model'], + 'answer': result['answer'], } @app.post('/api/settings/openai/test') async def test_openai_connection(): try: - answer = await ask_ai('Reply with exactly: DevConsole AI connection OK') + result = await ask_ai('Reply with exactly: DevConsole AI connection OK', 'test') except OpenAIConfigurationError as exc: raise HTTPException(status_code=400, detail=str(exc)) from exc return { 'success': True, - 'model': get_openai_model(), - 'answer': answer, + 'model': result['model'], + 'answer': result['answer'], }