Add vector IO and text filtering

This commit is contained in:
2026-01-29 17:02:51 +08:00
parent fc23781e17
commit ee5f02fff9
10 changed files with 3368 additions and 42 deletions

View File

@@ -15,6 +15,11 @@ export function getSettings() {
return ext;
}
const DEFAULT_FILTER_RULES = [
{ start: '<think>', end: '</think>' },
{ start: '<thinking>', end: '</thinking>' },
];
export function getSummaryPanelConfig() {
const defaults = {
api: { provider: 'st', url: '', key: '', model: '', modelCache: [] },
@@ -29,6 +34,7 @@ export function getSummaryPanelConfig() {
wrapperTail: '',
forceInsertAtEnd: false,
},
vector: null,
};
try {
const raw = localStorage.getItem('summary_panel_config');
@@ -64,12 +70,21 @@ export function getVectorConfig() {
const raw = localStorage.getItem('summary_panel_config');
if (!raw) return null;
const parsed = JSON.parse(raw);
return parsed.vector || null;
const cfg = parsed.vector || null;
if (cfg && !cfg.textFilterRules) {
cfg.textFilterRules = [...DEFAULT_FILTER_RULES];
}
return cfg;
} catch {
return null;
}
}
export function getTextFilterRules() {
const cfg = getVectorConfig();
return cfg?.textFilterRules || DEFAULT_FILTER_RULES;
}
export function saveVectorConfig(vectorCfg) {
try {
const raw = localStorage.getItem('summary_panel_config') || '{}';