feat: 话题迁移至洞察

This commit is contained in:
digua
2026-04-13 22:29:09 +08:00
committed by digua
parent 2b3f1fc04f
commit c7ad09b2d5
20 changed files with 132 additions and 55 deletions
+8 -5
View File
@@ -59,13 +59,16 @@ export function getJieba(dictType: DictType = 'default'): JiebaInstance {
const { Jieba } = require('@node-rs/jieba')
const diskDict = tryLoadDictFromDisk(effectiveType)
if (!diskDict) {
throw new Error(`Dict file not found for: ${effectiveType}. Please ensure the dictionary has been downloaded.`)
let instance: JiebaInstance
if (diskDict) {
instance = Jieba.withDict(diskDict)
console.log(`[NLP] jieba dict loaded: ${effectiveType} (${diskDict.length} bytes)`)
} else {
// 词库缺失时仍保留 jieba 能力,避免 FTS 退化为空格切分。
instance = new Jieba()
console.warn(`[NLP] jieba dict missing: ${effectiveType}, fallback to built-in tokenizer`)
}
const instance: JiebaInstance = Jieba.withDict(diskDict)
console.log(`[NLP] jieba dict loaded: ${effectiveType} (${diskDict.length} bytes)`)
jiebaInstances.set(effectiveType, instance)
return instance
} catch (error) {
+1 -1
View File
@@ -899,7 +899,7 @@ interface NetworkApi {
}
// NLP API 类型 - 自然语言处理功能
type SupportedLocale = 'zh-CN' | 'en-US'
type SupportedLocale = 'zh-CN' | 'en-US' | 'zh-TW' | 'ja-JP'
/** 词性过滤模式 */
type PosFilterMode = 'all' | 'meaningful' | 'custom'