feat(llm): introduce request-local source reference aliases

Replace raw chunk/document/KB IDs in LLM context with short cN/dN/bN/wN
aliases, decode tool arguments on the way in, and expand compact <ref/>
citations to the public <kb>/<web> format before user-facing output.
This commit is contained in:
wizardchen
2026-07-16 21:23:20 +08:00
committed by lyingbug
parent 79e8f3d894
commit 014164ae44
33 changed files with 1962 additions and 149 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ This will log an issue for human review or automated maintenance.`,
"suspected_knowledge_ids": {
"type": "array",
"items": { "type": "string" },
"description": "Optional list of knowledge_ids (from the <sources> block) that you suspect are causing the pollution or error."
"description": "Optional list of short dN document IDs from the <sources> block that you suspect are causing the pollution or error."
}
},
"required": ["slug", "issue_type", "description"]
@@ -72,7 +72,7 @@ func (t *wikiFlagIssueTool) Execute(ctx context.Context, args json.RawMessage) (
if len(t.kbIDs) == 0 {
return &types.ToolResult{Success: false, Error: "No knowledge bases available for issue tracking"}, nil
}
// Default to first KB ID if multiple (normally there's only one in this context)
kbID := t.kbIDs[0]
@@ -102,4 +102,4 @@ func (t *wikiFlagIssueTool) Execute(ctx context.Context, args json.RawMessage) (
Success: true,
Output: fmt.Sprintf("Successfully flagged issue for %s. A maintenance ticket has been created for review.", slug),
}, nil
}
}