feat(问翻小宝): 增强帮助搜索与会话历史

关键改动:

- 增加问翻小宝会话历史记录规则与测试

- 优化帮助搜索、兜底建议和页面交互结构

- 更新帮助截图资产和截图采集脚本

Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
Script Generator
2026-07-01 09:20:10 +08:00
parent 8683b341e2
commit e5ce2d221e
20 changed files with 714 additions and 81 deletions

View File

@@ -1,6 +1,11 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { getFallbackHelpSuggestions, searchHelpArticles } from './wenfan-help-search';
import {
getFallbackHelpMessage,
getFallbackHelpSuggestions,
searchHelpArticles,
shouldShowGenericHelpSuggestions,
} from './wenfan-help-search';
import { WENFAN_HELP_ARTICLES } from './wenfan-help-articles';
test('searchHelpArticles matches common product creation phrasing', () => {
@@ -27,6 +32,17 @@ test('searchHelpArticles matches bug creation from failed test cases', () => {
assert.equal(result[0]?.article.id, 'bug-workflow');
});
test('bug help article explains bug creation only from failed test cases', () => {
const article = WENFAN_HELP_ARTICLES.find((item) => item.id === 'bug-workflow');
assert.ok(article);
assert.match(article.entry, /测试用例/);
assert.match(article.entry, /提 BUG|提 Bug/);
assert.doesNotMatch(article.entry, /Bug Tab -> 新建 Bug/);
assert.ok(article.steps.some((step) => /失败|不通过/.test(step) && /提 BUG|提 Bug/.test(step)));
assert.ok(article.notes.some((note) => /不支持|不能/.test(note) && /Bug Tab/.test(note)));
});
test('searchHelpArticles keeps related article ids from the matched article', () => {
const result = searchHelpArticles('AI拆解测试用例在哪里', WENFAN_HELP_ARTICLES);
@@ -46,3 +62,16 @@ test('getFallbackHelpSuggestions returns starter examples when no article matche
'开发任务怎么提测?',
]);
});
test('getFallbackHelpMessage removes generic prompt wording when generic suggestions are hidden', () => {
assert.match(getFallbackHelpMessage(true), /常见问题/);
assert.doesNotMatch(getFallbackHelpMessage(false), /常见问题/);
assert.match(getFallbackHelpMessage(false), /更具体的系统关键词/);
});
test('shouldShowGenericHelpSuggestions hides generic prompts after the first user follow-up', () => {
assert.equal(shouldShowGenericHelpSuggestions(0), true);
assert.equal(shouldShowGenericHelpSuggestions(1), true);
assert.equal(shouldShowGenericHelpSuggestions(2), false);
assert.equal(shouldShowGenericHelpSuggestions(5), false);
});