sync update from LAN repo (source ji @ 85078a31)
This commit is contained in:
1 parent
5d6627af50
commit
e602d88695
864 files changed
+99150
-6346
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
// Node's type-stripping runner requires the explicit TypeScript suffix.
|
||||
// @ts-expect-error The application compiler intentionally uses extensionless imports.
|
||||
import * as answerDisplay from "./answer-display.ts";
|
||||
|
||||
const { stripKnowledgeRetrievalDiagnostics } = answerDisplay;
|
||||
|
||||
test("removes the inline partial-retrieval notice from a historical answer", () => {
|
||||
const content = [
|
||||
"## 回答",
|
||||
"这是基于 Wiki 的结论。[1]",
|
||||
"",
|
||||
"**资料不足与检索局限说明:** 本轮仅有部分检索通道成功(VECTOR_UNAVAILABLE),检索结果可能不完整。",
|
||||
].join("\n");
|
||||
|
||||
assert.equal(
|
||||
stripKnowledgeRetrievalDiagnostics(content),
|
||||
"## 回答\n这是基于 Wiki 的结论。[1]",
|
||||
);
|
||||
});
|
||||
|
||||
test("removes a multi-line diagnostic section without changing the answer", () => {
|
||||
const content = [
|
||||
"正文第一段。",
|
||||
"",
|
||||
"### 资料不足与检索局限说明",
|
||||
"本轮只有部分检索通道成功。",
|
||||
"- 内部错误码:VECTOR_UNAVAILABLE",
|
||||
"",
|
||||
"正文第二段。",
|
||||
].join("\n");
|
||||
|
||||
assert.equal(
|
||||
stripKnowledgeRetrievalDiagnostics(content),
|
||||
"正文第一段。\n\n正文第二段。",
|
||||
);
|
||||
});
|
||||
|
||||
test("leaves ordinary assistant content unchanged", () => {
|
||||
const content = "向量检索不可用时,可以继续使用关键词检索。";
|
||||
assert.equal(stripKnowledgeRetrievalDiagnostics(content), content);
|
||||
});
|
||||
Reference in new issue
Block a user