DB-Migrationen (status_history, category) + Claude CLI stdin-Übergabe
- status_history Spalte für fact_checks (Faktencheck-Verlauf als JSON) - category Spalte für article_locations (Marker-Klassifizierung) - Prompt-Übergabe an Claude CLI via stdin statt Argument (ARG_MAX) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -41,12 +41,14 @@ class UsageAccumulator:
|
||||
async def call_claude(prompt: str, tools: str | None = "WebSearch,WebFetch", model: str | None = None) -> tuple[str, ClaudeUsage]:
|
||||
"""Ruft Claude CLI auf. Gibt (result_text, usage) zurück.
|
||||
|
||||
Prompt wird via stdin uebergeben um OS ARG_MAX Limits zu vermeiden.
|
||||
|
||||
Args:
|
||||
prompt: Der Prompt für Claude
|
||||
prompt: Der Prompt fuer Claude
|
||||
tools: Kommagetrennte erlaubte Tools (None = keine Tools, --max-turns 1)
|
||||
model: Optionales Modell (z.B. CLAUDE_MODEL_FAST für Haiku). None = CLI-Default (Opus).
|
||||
model: Optionales Modell (z.B. CLAUDE_MODEL_FAST fuer Haiku). None = CLI-Default (Opus).
|
||||
"""
|
||||
cmd = [CLAUDE_PATH, "-p", prompt, "--output-format", "json"]
|
||||
cmd = [CLAUDE_PATH, "-p", "-", "--output-format", "json"]
|
||||
if model:
|
||||
cmd.extend(["--model", model])
|
||||
if tools:
|
||||
@@ -56,6 +58,7 @@ async def call_claude(prompt: str, tools: str | None = "WebSearch,WebFetch", mod
|
||||
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,
|
||||
stdin=asyncio.subprocess.PIPE,
|
||||
env={
|
||||
"PATH": "/usr/local/bin:/usr/bin:/bin",
|
||||
"HOME": "/home/claude-dev",
|
||||
@@ -64,7 +67,9 @@ async def call_claude(prompt: str, tools: str | None = "WebSearch,WebFetch", mod
|
||||
},
|
||||
)
|
||||
try:
|
||||
stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=CLAUDE_TIMEOUT)
|
||||
stdout, stderr = await asyncio.wait_for(
|
||||
process.communicate(input=prompt.encode("utf-8")), timeout=CLAUDE_TIMEOUT
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
process.kill()
|
||||
raise TimeoutError(f"Claude CLI Timeout nach {CLAUDE_TIMEOUT}s")
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren