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:
2026-10-16 15:21:42 +00:00
parent 299ea50fb5
commit 2f7a491666
176 changed files with 11869 additions and 2716 deletions

View File

@@ -1,3 +1,4 @@
// Modified in the independent AgentDesk fork: localized knowledge workflows and safe display errors.
type TFunction = (key: string, values?: Record<string, string | number>) => string
const CHANNEL_LABEL_KEYS: Record<string, string> = {
@@ -46,3 +47,37 @@ export function getKnowledgeChunkProviderLabel(value: string, t: TFunction) {
function translateByKey(key: string | undefined, fallback: string, t: TFunction) {
return key ? t(key) : fallback
}
const TYPE_LABEL_KEYS: Record<string, string> = {
document: "knowledge.typeDocument",
faq: "knowledge.typeFAQ",
}
const STATUS_LABEL_KEYS: Record<number, string> = {
0: "knowledge.statusOk",
1: "knowledge.statusDisabled",
2: "knowledge.statusDeleted",
}
const INDEX_STATUS_LABEL_KEYS: Record<string, string> = {
pending: "knowledge.indexPending",
indexed: "knowledge.indexIndexed",
failed: "knowledge.indexFailed",
}
export function getKnowledgeTypeLabel(value: string, t: TFunction) {
return translateByKey(TYPE_LABEL_KEYS[value], t("knowledge.unknownType"), t)
}
export function getKnowledgeStatusLabel(value: number, t: TFunction) {
return translateByKey(STATUS_LABEL_KEYS[value], t("knowledge.unknownStatus"), t)
}
export function getKnowledgeIndexStatusLabel(value: string, t: TFunction) {
return translateByKey(INDEX_STATUS_LABEL_KEYS[value], t("knowledge.unknownStatus"), t)
}
// Never expose a stored provider/SQL error, even when talking to an older server.
export function getKnowledgeIndexErrorLabel(error: string | undefined, t: TFunction) {
return error ? t("knowledge.indexFailureSummary") : ""
}