github-actions[bot] commited on
Commit ·
dcf66e9
1
Parent(s): 75d74eb
Auto-deploy from GitHub: 87e0ca1a33627f5348b4cfca932d2ca34ea1c3df
Browse files- app/services/worker.py +5 -6
app/services/worker.py
CHANGED
|
@@ -68,12 +68,9 @@ async def worker_loop():
|
|
| 68 |
if model == 'opencode':
|
| 69 |
await crud.update_progress(task_id, 10, "Running opencode...")
|
| 70 |
result = await loop.run_in_executor(None, lambda: _run_opencode(input_text))
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
await crud.update_status(task_id, 'completed', result=json.dumps({"response": result}))
|
| 75 |
-
else:
|
| 76 |
-
raise Exception("opencode returned empty result")
|
| 77 |
else:
|
| 78 |
result = await loop.run_in_executor(None, lambda: initiate(
|
| 79 |
{
|
|
@@ -113,6 +110,8 @@ def _run_opencode(text: str) -> str:
|
|
| 113 |
text=True,
|
| 114 |
timeout=300
|
| 115 |
)
|
|
|
|
|
|
|
| 116 |
if result.returncode != 0:
|
| 117 |
raise RuntimeError(f"opencode failed: {result.stderr.strip()}")
|
| 118 |
return result.stdout.strip()
|
|
|
|
| 68 |
if model == 'opencode':
|
| 69 |
await crud.update_progress(task_id, 10, "Running opencode...")
|
| 70 |
result = await loop.run_in_executor(None, lambda: _run_opencode(input_text))
|
| 71 |
+
logger.success(f"Successfully processed (opencode): {task_id}")
|
| 72 |
+
await crud.update_progress(task_id, 100, "Completed")
|
| 73 |
+
await crud.update_status(task_id, 'completed', result=json.dumps({"response": result}))
|
|
|
|
|
|
|
|
|
|
| 74 |
else:
|
| 75 |
result = await loop.run_in_executor(None, lambda: initiate(
|
| 76 |
{
|
|
|
|
| 110 |
text=True,
|
| 111 |
timeout=300
|
| 112 |
)
|
| 113 |
+
if result.stderr:
|
| 114 |
+
logger.debug(f"opencode stderr: {result.stderr.strip()}")
|
| 115 |
if result.returncode != 0:
|
| 116 |
raise RuntimeError(f"opencode failed: {result.stderr.strip()}")
|
| 117 |
return result.stdout.strip()
|