mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 14:22:28 +08:00
feat: add automatic fallback from edit_diagram to display_diagram with 3-retry policy
- Updated system prompt to allow up to 3 retry attempts with adjusted search patterns - Simplified error response to provide current diagram XML and reference retry policy - AI model self-manages retries based on system instructions
This commit is contained in:
@@ -98,10 +98,18 @@ export default function ChatPanel() {
|
||||
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
|
||||
// Provide detailed error with current diagram XML
|
||||
addToolResult({
|
||||
tool: "edit_diagram",
|
||||
toolCallId: toolCall.toolCallId,
|
||||
output: `Failed to edit diagram: ${errorMessage}`,
|
||||
output: `Edit failed: ${errorMessage}
|
||||
|
||||
Current diagram XML:
|
||||
\`\`\`xml
|
||||
${currentXml}
|
||||
\`\`\`
|
||||
|
||||
Please retry with an adjusted search pattern or use display_diagram if retries are exhausted.`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user