feat: harden support, localize knowledge and add operator availability [skip ci]
Source-only publication of reviewed commit 64e96a7f423673dc29ad56485be9fc79bce8af1c.
Passed in isolation: focused frontend/backend tests, race checks, TypeScript typecheck, lint, Go compilation, Flowgram build, and deterministic SDK build/tests.
Not accepted as a production release: Next.js export/native assembly remains blocked by environment memory limits; browser interaction and MySQL staging acceptance remain unverified. No production server, database/schema, runtime configuration, deployment, release tag, or workflow execution was performed.
Expected source tree: 0a4a7528e9.
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
// Modified in the independent AgentDesk fork: localized knowledge workflows and safe display errors.
|
||||
package rag
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"agent-desk/internal/pkg/i18nx"
|
||||
|
||||
"agent-desk/internal/models"
|
||||
)
|
||||
|
||||
@@ -14,7 +18,7 @@ func TestBuildFAQChunkContent(t *testing.T) {
|
||||
Answer: "在订单页发起退款。",
|
||||
}
|
||||
|
||||
content := buildFAQChunkContent(faq)
|
||||
content := sourceFAQContent(faq).render(i18nx.LocaleZhCN)
|
||||
if !strings.Contains(content, "问题:如何退款") {
|
||||
t.Fatalf("expected question in content, got %q", content)
|
||||
}
|
||||
@@ -70,7 +74,7 @@ func TestNormalizeContextResultsMergesAndDedupes(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBuildContextChunkText(t *testing.T) {
|
||||
faqText := buildContextChunkText(RetrieveResult{
|
||||
faqText := buildContextChunkText(i18nx.WithLocale(context.Background(), i18nx.LocaleZhCN), RetrieveResult{
|
||||
FaqID: 1,
|
||||
FaqQuestion: "如何退款",
|
||||
Content: "在订单页发起退款。",
|
||||
@@ -79,7 +83,7 @@ func TestBuildContextChunkText(t *testing.T) {
|
||||
t.Fatalf("unexpected faq context text: %q", faqText)
|
||||
}
|
||||
|
||||
docText := buildContextChunkText(RetrieveResult{
|
||||
docText := buildContextChunkText(i18nx.WithLocale(context.Background(), i18nx.LocaleZhCN), RetrieveResult{
|
||||
DocumentID: 2,
|
||||
DocumentTitle: "退款文档",
|
||||
SectionPath: "售后/退款",
|
||||
|
||||
Reference in New Issue
Block a user