update
This commit is contained in:
@@ -28,3 +28,7 @@ AGENT_TIMEOUT = 3600
|
|||||||
|
|
||||||
MAX_CONCURRENT_GENERATIONS = 6
|
MAX_CONCURRENT_GENERATIONS = 6
|
||||||
CLAUDE_CLI = "claude"
|
CLAUDE_CLI = "claude"
|
||||||
|
|
||||||
|
MODEL_GUIDE = "claude-opus-4-8"
|
||||||
|
MODEL_BAUSTEIN_GEN = "claude-sonnet-4-6"
|
||||||
|
MODEL_BAUSTEIN_REWORK = "claude-haiku-4-5"
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ from config import (
|
|||||||
CLAUDE_CLI,
|
CLAUDE_CLI,
|
||||||
TEMPLATES_DIR,
|
TEMPLATES_DIR,
|
||||||
MAX_CONCURRENT_GENERATIONS,
|
MAX_CONCURRENT_GENERATIONS,
|
||||||
|
MODEL_GUIDE,
|
||||||
|
MODEL_BAUSTEIN_GEN,
|
||||||
|
MODEL_BAUSTEIN_REWORK,
|
||||||
STORAGE_DIR,
|
STORAGE_DIR,
|
||||||
)
|
)
|
||||||
from database import (
|
from database import (
|
||||||
@@ -45,8 +48,10 @@ async def _set_progress(guide_id: str, progress: str) -> None:
|
|||||||
await update_guide(guide_id, progress=progress, updated_at=now)
|
await update_guide(guide_id, progress=progress, updated_at=now)
|
||||||
|
|
||||||
|
|
||||||
async def _run_claude(guide_id: str, prompt: str, timeout: int, tools: str | None = "Write,Bash,Read,WebSearch,WebFetch") -> tuple[int, str, str]:
|
async def _run_claude(guide_id: str, prompt: str, timeout: int, tools: str | None = "Write,Bash,Read,WebSearch,WebFetch", model: str | None = None) -> tuple[int, str, str]:
|
||||||
cmd = [CLAUDE_CLI, "-p"]
|
cmd = [CLAUDE_CLI, "-p"]
|
||||||
|
if model:
|
||||||
|
cmd += ["--model", model]
|
||||||
if tools:
|
if tools:
|
||||||
cmd += ["--allowedTools", tools]
|
cmd += ["--allowedTools", tools]
|
||||||
cmd += ["--dangerously-skip-permissions"]
|
cmd += ["--dangerously-skip-permissions"]
|
||||||
@@ -188,7 +193,7 @@ async def generate_guide(guide_id: str, topic: str, format_name: str, instructio
|
|||||||
# Step 1: Generator-Agent erstellt HTML
|
# Step 1: Generator-Agent erstellt HTML
|
||||||
await _set_progress(guide_id, "Generiere HTML…")
|
await _set_progress(guide_id, "Generiere HTML…")
|
||||||
gen_prompt = _build_generator_prompt(topic, format_name, html_path, instructions)
|
gen_prompt = _build_generator_prompt(topic, format_name, html_path, instructions)
|
||||||
returncode, stdout, stderr = await _run_claude(guide_id, gen_prompt, AGENT_TIMEOUT)
|
returncode, stdout, stderr = await _run_claude(guide_id, gen_prompt, AGENT_TIMEOUT, model=MODEL_GUIDE)
|
||||||
|
|
||||||
if guide_id in _cancelled:
|
if guide_id in _cancelled:
|
||||||
return
|
return
|
||||||
@@ -208,7 +213,7 @@ async def generate_guide(guide_id: str, topic: str, format_name: str, instructio
|
|||||||
current_step = "Inhalts-Review"
|
current_step = "Inhalts-Review"
|
||||||
current_timeout = AGENT_TIMEOUT
|
current_timeout = AGENT_TIMEOUT
|
||||||
content_prompt = _build_content_review_prompt(topic, format_name, html_path)
|
content_prompt = _build_content_review_prompt(topic, format_name, html_path)
|
||||||
returncode, review_out, review_err = await _run_claude(guide_id, content_prompt, AGENT_TIMEOUT)
|
returncode, review_out, review_err = await _run_claude(guide_id, content_prompt, AGENT_TIMEOUT, model=MODEL_GUIDE)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
await _fail(guide_id, f"Inhalts-Review-Fehler: {review_err[:1000]}")
|
await _fail(guide_id, f"Inhalts-Review-Fehler: {review_err[:1000]}")
|
||||||
@@ -224,7 +229,7 @@ async def generate_guide(guide_id: str, topic: str, format_name: str, instructio
|
|||||||
current_step = "Inhalts-Korrektur"
|
current_step = "Inhalts-Korrektur"
|
||||||
current_timeout = AGENT_TIMEOUT
|
current_timeout = AGENT_TIMEOUT
|
||||||
fix_prompt = _build_fix_prompt(topic, format_name, html_path, feedback)
|
fix_prompt = _build_fix_prompt(topic, format_name, html_path, feedback)
|
||||||
returncode, _, fix_err = await _run_claude(guide_id, fix_prompt, AGENT_TIMEOUT)
|
returncode, _, fix_err = await _run_claude(guide_id, fix_prompt, AGENT_TIMEOUT, model=MODEL_GUIDE)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
await _fail(guide_id, f"Fix-Fehler: {fix_err[:1000]}")
|
await _fail(guide_id, f"Fix-Fehler: {fix_err[:1000]}")
|
||||||
@@ -276,7 +281,7 @@ async def rework_guide(guide_id: str, topic: str, format_name: str, instructions
|
|||||||
current_timeout = AGENT_TIMEOUT
|
current_timeout = AGENT_TIMEOUT
|
||||||
|
|
||||||
rework_prompt = _build_rework_prompt(topic, format_name, tmp_html, instructions)
|
rework_prompt = _build_rework_prompt(topic, format_name, tmp_html, instructions)
|
||||||
returncode, stdout, stderr = await _run_claude(guide_id, rework_prompt, AGENT_TIMEOUT)
|
returncode, stdout, stderr = await _run_claude(guide_id, rework_prompt, AGENT_TIMEOUT, model=MODEL_GUIDE)
|
||||||
|
|
||||||
if guide_id in _cancelled:
|
if guide_id in _cancelled:
|
||||||
return
|
return
|
||||||
@@ -398,7 +403,7 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
|||||||
|
|
||||||
prompt = _build_suggestions_prompt(topic, html_paths, existing_titles)
|
prompt = _build_suggestions_prompt(topic, html_paths, existing_titles)
|
||||||
tools = "Read" if html_paths else None
|
tools = "Read" if html_paths else None
|
||||||
returncode, stdout, stderr = await _run_claude("suggestions-" + topic, prompt, 180, tools=tools)
|
returncode, stdout, stderr = await _run_claude("suggestions-" + topic, prompt, 180, tools=tools, model=MODEL_BAUSTEIN_GEN)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
return
|
return
|
||||||
@@ -431,7 +436,7 @@ async def generate_suggestions(topic: str, html_paths: list[Path]) -> None:
|
|||||||
async def generate_baustein_detail(baustein_id: str, topic: str, title: str) -> None:
|
async def generate_baustein_detail(baustein_id: str, topic: str, title: str) -> None:
|
||||||
try:
|
try:
|
||||||
prompt = _build_baustein_detail_prompt(topic, title)
|
prompt = _build_baustein_detail_prompt(topic, title)
|
||||||
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None)
|
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None, model=MODEL_BAUSTEIN_GEN)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
return
|
return
|
||||||
@@ -455,7 +460,7 @@ async def generate_baustein_detail(baustein_id: str, topic: str, title: str) ->
|
|||||||
async def rework_baustein(baustein_id: str, topic: str, title: str, current: dict, instructions: str) -> None:
|
async def rework_baustein(baustein_id: str, topic: str, title: str, current: dict, instructions: str) -> None:
|
||||||
try:
|
try:
|
||||||
prompt = _build_baustein_rework_prompt(topic, title, current, instructions)
|
prompt = _build_baustein_rework_prompt(topic, title, current, instructions)
|
||||||
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None)
|
returncode, stdout, stderr = await _run_claude("baustein-" + baustein_id, prompt, 60, tools=None, model=MODEL_BAUSTEIN_REWORK)
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ async function handleAdd() {
|
|||||||
newTitle.value = ''
|
newTitle.value = ''
|
||||||
const created = await createBaustein(props.topic, title)
|
const created = await createBaustein(props.topic, title)
|
||||||
bausteine.value.push(created)
|
bausteine.value.push(created)
|
||||||
|
reworkingSnapshots.set(created.id, created.updated_at)
|
||||||
|
reworkingIds.value = new Set([...reworkingIds.value, created.id])
|
||||||
|
startBausteinPolling()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDelete(id) {
|
async function handleDelete(id) {
|
||||||
@@ -186,8 +189,8 @@ onUnmounted(stopPolling)
|
|||||||
<pre v-html="ex.code"></pre>
|
<pre v-html="ex.code"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="reworkingIds.has(b.id)" class="loading-text">Wird überarbeitet…</p>
|
<p v-if="!b.description && !b.purpose" class="loading-text">Wird generiert…</p>
|
||||||
<p v-else-if="!b.description && !b.purpose" class="loading-text">Wird generiert…</p>
|
<p v-else-if="reworkingIds.has(b.id)" class="loading-text">Wird überarbeitet…</p>
|
||||||
<div class="rework-row">
|
<div class="rework-row">
|
||||||
<input
|
<input
|
||||||
v-model="reworkInputs[b.id]"
|
v-model="reworkInputs[b.id]"
|
||||||
|
|||||||
Reference in New Issue
Block a user