mirror of
https://github.com/open-webui/computer.git
synced 2026-12-01 09:22:45 -05:00
refac
This commit is contained in:
1 parent
4486d6dcc6
commit
147252a449
2 files changed
+4
-3
No files matched your search
@@ -26,6 +26,7 @@ ENABLE_CHAT_RECONCILE_ON_STARTUP: bool = os.environ.get(
|
||||
"ENABLE_CHAT_RECONCILE_ON_STARTUP", "true"
|
||||
).lower() in ("true", "1", "yes")
|
||||
CHAT_TOOL_MAX_CHARS = int(os.environ.get("CHAT_TOOL_MAX_CHARS", "50000"))
|
||||
CHAT_TOOL_COMMAND_MAX_CHARS = int(os.environ.get("CHAT_TOOL_COMMAND_MAX_CHARS", "8000"))
|
||||
|
||||
# ── AI stream settings ──────────────────────────────────────
|
||||
STREAM_CONNECT_TIMEOUT_SECONDS = float(os.environ.get("CPTR_STREAM_CONNECT_TIMEOUT", "30"))
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import os
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from typing import get_type_hints
|
||||
from cptr.env import CHAT_TOOL_MAX_CHARS
|
||||
from cptr.env import CHAT_TOOL_COMMAND_MAX_CHARS, CHAT_TOOL_MAX_CHARS
|
||||
|
||||
|
||||
# ── Background task state ───────────────────────────────────
|
||||
@@ -463,7 +463,7 @@ async def run_command(
|
||||
timeout = min(max(timeout, 5), 300)
|
||||
stdout, _ = await asyncio.wait_for(proc.communicate(), timeout=timeout)
|
||||
output = stdout.decode(errors="replace").strip()
|
||||
output = _truncate_output(output)
|
||||
output = _truncate_output(output, max_chars=CHAT_TOOL_COMMAND_MAX_CHARS)
|
||||
|
||||
if proc.returncode != 0:
|
||||
return f"Exit code {proc.returncode}\n{output}"
|
||||
@@ -487,7 +487,7 @@ async def check_task(task_id: str, *, workspace: str) -> str:
|
||||
|
||||
proc = task["proc"]
|
||||
output = task["output"].decode(errors="replace")
|
||||
output = _truncate_output(output)
|
||||
output = _truncate_output(output, max_chars=CHAT_TOOL_COMMAND_MAX_CHARS)
|
||||
|
||||
done = task.get("done", False) or proc.returncode is not None
|
||||
if done:
|
||||
|
||||
Reference in new issue
Block a user