feat(S1): iterative conversation for multi-round prompt refinement

- Conversation model: store dialog context (max 10 rounds), JSON messages
- POST /api/prompt/continue: append round, build LLM context from history
- GET/DELETE /api/conversation/🆔 retrieve or clear conversation
- Vue: refine input card below result, round counter, reset button
- Vue: continuePrompt API with conversation_id tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-03 09:49:22 +08:00
parent eb5056b5f2
commit 53d179dd00
5 changed files with 308 additions and 1 deletions

View File

@@ -17,3 +17,21 @@ export function fetchTemplatesByCategory(category: string) {
export function generatePrompt(body: { input_text: string; template_id: number | null; max_tokens?: number }) {
return client.post<GeneratePromptResponse>('/api/prompt/generate', body).then((r) => r.data)
}
export interface ContinuePromptResponse {
success: boolean
message?: string
conversation_id: number
generated_text: string
rounds: number
prompt?: { id: number; input_text: string; generated_text: string }
}
export function continuePrompt(body: {
conversation_id?: number | null
previous_result: string
refine_instruction: string
template_id?: number | null
}) {
return client.post<ContinuePromptResponse>('/api/prompt/continue', body).then((r) => r.data)
}