feat: 更新组件和引导对话,增强用户体验

- 在多个组件中添加新的选择和填空功能,提升互动性。
- 更新引导对话文本,确保信息准确性和一致性。
- 引入新的选择组件,优化用户填写体验。
- 清理冗余代码,提升可维护性。
This commit is contained in:
zhongyidian committed 2026-01-16 17:54:51 +08:00
1 parent a8723ab4aa
commit 5bdfdadede
27 files changed
+880 -1252

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
/**
* 敏感词屏蔽字库
* 用于过滤用户输入中的敏感词汇,将其替换为 *
*/
// 敏感词库(可根据实际需求扩展)
const SENSITIVE_WORDS = [
"敏感词1",
"敏感词2",
"测试",
"垃圾",
// 可以根据实际需求添加更多敏感词
];
/**
* 检查文本中是否包含敏感词
* @param text 待检查的文本
* @returns 是否包含敏感词
*/
export function containsSensitiveWord(text: string): boolean {
if (!text) return false;
const normalizedText = text.toLowerCase().trim();
return SENSITIVE_WORDS.some((word) =>
normalizedText.includes(word.toLowerCase())
);
}
/**
* 将文本中的敏感词替换为 *
* @param text 待处理的文本
* @returns 处理后的文本
*/
export function filterSensitiveWords(text: string): string {
if (!text) return text;
let result = text;
SENSITIVE_WORDS.forEach((word) => {
const regex = new RegExp(word, "gi");
result = result.replace(regex, "*".repeat(word.length));
});
return result;
}
/**
* 实时过滤输入内容(在用户输入时调用)
* @param input 用户输入的内容
* @returns 过滤后的内容
*/
export function filterInput(input: string): string {
if (!input) return input;
// 先进行敏感词过滤
let filtered = filterSensitiveWords(input);
return filtered;
}