2ab8b56a01
此提交实现了完整的知识库管理系统: 1. 新增Vue3 + Antd Vue前端管理后台,包含登录、文档管理、检索、类目设置等完整页面 2. 重构后端LLM调用抽象层,支持Ollama与OpenAI兼容服务动态切换 3. 调整默认嵌入模型配置为本地bge-m3模式 4. 优化入库任务去重逻辑与缓存清理机制 5. 完善Docker镜像构建与docker-compose部署配置 6. 修复多项测试用例与兼容性问题 7. 新增运行时配置API,支持动态调整系统参数
39 lines
804 B
JavaScript
39 lines
804 B
JavaScript
/**
|
|
* 截断文本,超过最大长度追加省略号
|
|
* @param {string} text
|
|
* @param {number} [maxLen=80]
|
|
* @returns {string}
|
|
*/
|
|
export function truncate(text, maxLen = 80) {
|
|
if (!text) return ''
|
|
const s = String(text)
|
|
return s.length > maxLen ? `${s.slice(0, maxLen)}…` : s
|
|
}
|
|
|
|
/**
|
|
* 安全拼接类名
|
|
* @param {...(string | false | null | undefined)} args
|
|
* @returns {string}
|
|
*/
|
|
export function classnames(...args) {
|
|
return args.filter(Boolean).join(' ')
|
|
}
|
|
|
|
/**
|
|
* 防抖
|
|
* @param {Function} fn
|
|
* @param {number} [wait=300]
|
|
* @returns {Function}
|
|
*/
|
|
export function debounce(fn, wait = 300) {
|
|
let timer = null
|
|
return function debounced(...args) {
|
|
if (timer) {
|
|
clearTimeout(timer)
|
|
}
|
|
timer = setTimeout(() => {
|
|
fn.apply(this, args)
|
|
}, wait)
|
|
}
|
|
}
|