3 Commits

Author SHA1 Message Date
Benjamin Admin b28f266cbe chore: fp-patch — import 1M kunden/umsatz + recompute Base Case
Build pitch-deck / build-push-deploy (push) Successful in 1m25s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 44s
CI / test-python-voice (push) Successful in 34s
CI / test-bqas (push) Successful in 35s
2026-04-22 20:33:23 +02:00
Benjamin Admin 736ddf647d fix(llm-dedup): use think:false instead of /no_think, restore 30s timeout
Ollama API supports "think": false to disable extended thinking mode
on qwen3.5. Reduces response time from 95s to ~3s per comparison.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 20:31:13 +02:00
Benjamin Admin 2188d6645e fix(llm-dedup): increase timeout to 120s, add /no_think, limit output to 200 tokens
qwen3.5 uses extended thinking by default which causes 95s+ responses
and 30s timeouts. Add /no_think to system prompt and num_predict=200
to keep responses short.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 20:27:58 +02:00
2 changed files with 37 additions and 36 deletions
@@ -1481,6 +1481,8 @@ async def _run_llm_dedup(req: LLMDedupRequest, job_id: str):
json={
"model": req.model,
"stream": False,
"think": False,
"options": {"num_predict": 200},
"messages": [
{"role": "system", "content": "Du bist ein Compliance-Experte. Vergleiche zwei Controls und entscheide: DUPLIKAT (gleiche Anforderung, nur anders formuliert) oder VERSCHIEDEN (unterschiedlicher Scope/Inhalt). Antworte NUR mit einem JSON: {\"verdict\": \"DUPLIKAT\" oder \"VERSCHIEDEN\", \"reason\": \"kurze Begruendung\"}"},
{"role": "user", "content": prompt},
+35 -36
View File
@@ -1,47 +1,46 @@
import { NextResponse } from 'next/server'
import { NextRequest, NextResponse } from 'next/server'
import pool from '@/lib/db'
import { computeFinanzplan } from '@/lib/finanzplan/engine'
export async function POST() {
const VER_1M = 'b7204781-aba0-45cc-a655-a0ff88d1173a'
export async function POST(request: NextRequest) {
const body = await request.json().catch(() => ({}))
const results: string[] = []
try {
// 1. Get current funding data from version
const { rows: fundingRows } = await pool.query(
`SELECT data FROM pitch_version_data WHERE version_id=$1 AND table_name='funding'`, [VER_1M])
if (fundingRows.length > 0) {
const funding = typeof fundingRows[0].data === 'string' ? JSON.parse(fundingRows[0].data) : fundingRows[0].data
results.push(`Current funding: ${JSON.stringify(funding)}`)
// Update: remove Wandeldarlehen from instrument, set round to Pre-Seed
if (Array.isArray(funding) && funding.length > 0) {
funding[0].instrument = 'Equity'
funding[0].round_name = 'Pre-Seed'
await pool.query(
`UPDATE pitch_version_data SET data=$1 WHERE version_id=$2 AND table_name='funding'`,
[JSON.stringify(funding), VER_1M])
results.push('Updated: instrument=Equity, round=Pre-Seed')
}
} else {
results.push('No funding data in version')
}
// 2. Check what fm_scenarios the 1M version uses
const { rows: scenRows } = await pool.query(
`SELECT data FROM pitch_version_data WHERE version_id=$1 AND table_name='fm_scenarios'`, [VER_1M])
if (scenRows.length > 0) {
results.push(`fm_scenarios: ${JSON.stringify(scenRows[0].data)}`)
}
// 3. Check Base Case scenario data counts
// Get Base Case scenario ID on production
const BASE = (await pool.query("SELECT id FROM fp_scenarios WHERE is_default=true LIMIT 1")).rows[0]?.id
if (BASE) {
for (const t of ['fp_kunden', 'fp_umsatzerloese', 'fp_personalkosten']) {
const { rows: [c] } = await pool.query(`SELECT COUNT(*) as cnt FROM ${t} WHERE scenario_id=$1`, [BASE])
results.push(`${t}: ${c.cnt} rows`)
if (!BASE) { results.push('NO BASE SCENARIO'); return NextResponse.json({ ok: false, results }) }
// Import kunden
if (body.kunden?.length) {
await pool.query(`DELETE FROM fp_kunden WHERE scenario_id=$1`, [BASE])
for (const r of body.kunden) {
await pool.query(
`INSERT INTO fp_kunden (scenario_id,segment_name,segment_index,row_label,row_index,is_editable,values,sort_order) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)`,
[BASE, r.segment_name, r.segment_index, r.row_label, r.row_index, r.is_editable, JSON.stringify(r.values), r.sort_order])
}
results.push(`kunden: ${body.kunden.length}`)
}
// Import umsatz
if (body.umsatz?.length) {
await pool.query(`DELETE FROM fp_umsatzerloese WHERE scenario_id=$1`, [BASE])
for (const r of body.umsatz) {
await pool.query(
`INSERT INTO fp_umsatzerloese (scenario_id,section,row_label,row_index,is_editable,values,sort_order) VALUES ($1,$2,$3,$4,$5,$6,$7)`,
[BASE, r.section, r.row_label, r.row_index, r.is_editable, JSON.stringify(r.values), r.sort_order])
}
results.push(`umsatz: ${body.umsatz.length}`)
}
// Recompute Base Case
const r = await computeFinanzplan(pool, BASE)
results.push(`BASE cash_m60=${r.liquiditaet?.endstand?.m60}`)
// Verify
const { rows: guv } = await pool.query(
`SELECT (values->>'y2026')::numeric as y26, (values->>'y2030')::numeric as y30 FROM fp_guv WHERE scenario_id=$1 AND row_label='Umsatzerlöse'`, [BASE])
results.push(`Umsatz: ${JSON.stringify(guv[0])}`)
} catch (err) {
results.push(`ERROR: ${err instanceof Error ? err.message : String(err)}`)
}