feat: 完善来源标注徽章功能和配置优化
后端改进: - 改进 addCitationsToResponse 函数,更激进地添加来源标注 - 支持识别所有有实质内容的行(长度>5) - 优化特殊行的识别逻辑,保留'依据引用'、'分析'、'建议'等内容行 - 修复 go.mod 中 lib/pq 的依赖问题 - 优化字符串拼接效率(使用 fmt.Fprintf) - 添加 Scanner 错误检查 前端改进: - 优化徽章样式,增大尺寸和间距 - 改用 bg-blue-100 和 bg-orange-100 背景 - 添加 hover 效果和 cursor-pointer 配置优化: - LLM 服务地址改为 IP(192.168.1.6:18888),支持外部调用 - 本地服务保持 localhost,性能更优 测试: - 新增 6 个单元测试用例,全部通过 - 验证清单项、列表项、陈述句等各种格式的标注 文档: - 添加实现方案文档 - 添加用户使用指南
This commit is contained in:
@@ -73,16 +73,16 @@ const mdComponents: Components = {
|
||||
if (href === "#cite-kb") {
|
||||
const label = String(children).replace(/^知识库:/, "");
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-0.5 mx-0.5 text-xs font-medium rounded-md bg-blue-50 text-blue-700 border border-blue-200 align-middle">
|
||||
<BookOpen className="h-3 w-3 shrink-0" />
|
||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 mx-0.5 text-xs font-semibold rounded bg-blue-100 text-blue-700 border border-blue-300 align-middle hover:bg-blue-200 transition-colors cursor-pointer">
|
||||
<BookOpen className="h-3.5 w-3.5 shrink-0" />
|
||||
<span>{label}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (href === "#cite-ai") {
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-0.5 mx-0.5 text-xs font-medium rounded-md bg-amber-50 text-amber-700 border border-amber-200 align-middle whitespace-nowrap">
|
||||
<BrainCircuit className="h-3 w-3 shrink-0" />
|
||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 mx-0.5 text-xs font-semibold rounded bg-orange-100 text-orange-700 border border-orange-300 align-middle whitespace-nowrap hover:bg-orange-200 transition-colors cursor-pointer">
|
||||
<BrainCircuit className="h-3.5 w-3.5 shrink-0" />
|
||||
<span>AI建议</span>
|
||||
</span>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user