refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s

- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名)
- 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块)
- docreader proto 描述符采用等长替换,保持序列化字节布局有效
- Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像
- 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
runny committed 2026-11-13 20:52:51 +08:00
1 parent 9097ee699d
commit 9058149576
3136 files changed
+18018 -18004

No files matched your search

+9 -9
View File
@@ -97,14 +97,14 @@ export interface AssistantOpenRequest {
focus?: Pick<AssistantPageContext, 'wikiIssueIds'>
}
const SESSION_KEY_PREFIX = 'weknora:assistant-session'
const VISIBLE_KEY_PREFIX = 'weknora:assistant-visible'
const MODEL_KEY_PREFIX = 'weknora:assistant-model'
const ACCESS_KEY_PREFIX = 'weknora:assistant-access'
const PAGE_ACCESS_KEY_PREFIX = 'weknora:assistant-page-access'
const LAYOUT_KEY = 'weknora:assistant-layout'
const WIDTH_KEY = 'weknora:assistant-width'
const ENTRY_KEY = 'weknora:assistant-entry'
const SESSION_KEY_PREFIX = 'academy:assistant-session'
const VISIBLE_KEY_PREFIX = 'academy:assistant-visible'
const MODEL_KEY_PREFIX = 'academy:assistant-model'
const ACCESS_KEY_PREFIX = 'academy:assistant-access'
const PAGE_ACCESS_KEY_PREFIX = 'academy:assistant-page-access'
const LAYOUT_KEY = 'academy:assistant-layout'
const WIDTH_KEY = 'academy:assistant-width'
const ENTRY_KEY = 'academy:assistant-entry'
/** Docked pushes the page aside; floating hovers over it. Neither blocks it. */
export type AssistantLayout = 'docked' | 'floating'
@@ -179,7 +179,7 @@ function hasPageContext(context: Partial<AssistantPageContext>): boolean {
}
/**
* Pinia store behind the global WeKnora assistant panel (rendered once in
* Pinia store behind the global Academy assistant panel (rendered once in
* platform/index.vue). Pages publish what is open through
* useAssistantPageContext; anything can open the panel with open().
*/
+41 -41
View File
@@ -135,7 +135,7 @@ export const useAuthStore = defineStore('auth', () => {
// UI to a Viewer who switched into a tenant where they were a Viewer
// — every gate above (`hasRole(...)`) returned the home-tenant role.
//
// SECURITY: This value is read from localStorage (`weknora_memberships`)
// SECURITY: This value is read from localStorage (`academy_memberships`)
// and therefore MUST be treated as UI-rendering-only — any user can
// tamper with localStorage and grant themselves "owner" here. All real
// authorisation decisions live on the server (auth middleware resolves
@@ -191,7 +191,7 @@ export const useAuthStore = defineStore('auth', () => {
const previousId = user.value?.id
user.value = userData
// 保存到localStorage
localStorage.setItem('weknora_user', JSON.stringify(userData))
localStorage.setItem('academy_user', JSON.stringify(userData))
if (previousId !== userData.id) {
reloadUserPreferences()
}
@@ -200,35 +200,35 @@ export const useAuthStore = defineStore('auth', () => {
const setTenant = (tenantData: TenantInfo | null) => {
tenant.value = tenantData
if (tenantData) {
localStorage.setItem('weknora_tenant', JSON.stringify(tenantData))
localStorage.setItem('academy_tenant', JSON.stringify(tenantData))
} else {
localStorage.removeItem('weknora_tenant')
localStorage.removeItem('academy_tenant')
setSelectedTenant(null, null)
}
}
const setToken = (tokenValue: string) => {
token.value = tokenValue
localStorage.setItem('weknora_token', tokenValue)
localStorage.setItem('academy_token', tokenValue)
}
const setRefreshToken = (refreshTokenValue: string) => {
refreshToken.value = refreshTokenValue
localStorage.setItem('weknora_refresh_token', refreshTokenValue)
localStorage.setItem('academy_refresh_token', refreshTokenValue)
}
const setKnowledgeBases = (kbList: KnowledgeBaseInfo[]) => {
// 确保输入是数组
knowledgeBases.value = Array.isArray(kbList) ? kbList : []
localStorage.setItem('weknora_knowledge_bases', JSON.stringify(knowledgeBases.value))
localStorage.setItem('academy_knowledge_bases', JSON.stringify(knowledgeBases.value))
}
const setCurrentKnowledgeBase = (kb: KnowledgeBaseInfo | null) => {
currentKnowledgeBase.value = kb
if (kb) {
localStorage.setItem('weknora_current_kb', JSON.stringify(kb))
localStorage.setItem('academy_current_kb', JSON.stringify(kb))
} else {
localStorage.removeItem('weknora_current_kb')
localStorage.removeItem('academy_current_kb')
}
}
@@ -240,9 +240,9 @@ export const useAuthStore = defineStore('auth', () => {
// only on an actual tenant change, so logout / init paths are not touched.
const clearTenantScopedClientState = () => {
try {
localStorage.removeItem('weknora_last_chat_model_id')
localStorage.removeItem('weknora_current_kb')
const raw = localStorage.getItem('WeKnora_settings')
localStorage.removeItem('academy_last_chat_model_id')
localStorage.removeItem('academy_current_kb')
const raw = localStorage.getItem('Academy_settings')
if (raw) {
const parsed = JSON.parse(raw)
if (parsed && typeof parsed === 'object') {
@@ -258,7 +258,7 @@ export const useAuthStore = defineStore('auth', () => {
parsed.selectedFiles = []
parsed.selectedFileKbMap = {}
parsed.knowledgeBaseId = ''
localStorage.setItem('WeKnora_settings', JSON.stringify(parsed))
localStorage.setItem('Academy_settings', JSON.stringify(parsed))
}
}
} catch (e) {
@@ -273,13 +273,13 @@ export const useAuthStore = defineStore('auth', () => {
selectedTenantId.value = tenantId
selectedTenantName.value = tenantName
if (tenantId !== null) {
localStorage.setItem('weknora_selected_tenant_id', String(tenantId))
localStorage.setItem('academy_selected_tenant_id', String(tenantId))
if (tenantName) {
localStorage.setItem('weknora_selected_tenant_name', tenantName)
localStorage.setItem('academy_selected_tenant_name', tenantName)
}
} else {
localStorage.removeItem('weknora_selected_tenant_id')
localStorage.removeItem('weknora_selected_tenant_name')
localStorage.removeItem('academy_selected_tenant_id')
localStorage.removeItem('academy_selected_tenant_name')
}
if (tenantChanged) {
clearTenantScopedClientState()
@@ -294,7 +294,7 @@ export const useAuthStore = defineStore('auth', () => {
list: Array<{ tenant_id: number; tenant_name?: string; role: string }>
) => {
memberships.value = Array.isArray(list) ? list : []
localStorage.setItem('weknora_memberships', JSON.stringify(memberships.value))
localStorage.setItem('academy_memberships', JSON.stringify(memberships.value))
}
// setPendingInvitationCount is the explicit setter used by the
@@ -436,9 +436,9 @@ export const useAuthStore = defineStore('auth', () => {
const setLiteMode = (value: boolean) => {
isLiteMode.value = value
if (value) {
localStorage.setItem('weknora_lite_mode', 'true')
localStorage.setItem('academy_lite_mode', 'true')
} else {
localStorage.removeItem('weknora_lite_mode')
localStorage.removeItem('academy_lite_mode')
}
}
@@ -463,19 +463,19 @@ export const useAuthStore = defineStore('auth', () => {
clearSessionResourceCaches()
// 清空localStorage
localStorage.removeItem('weknora_user')
localStorage.removeItem('weknora_tenant')
localStorage.removeItem('weknora_token')
localStorage.removeItem('weknora_refresh_token')
localStorage.removeItem('weknora_knowledge_bases')
localStorage.removeItem('weknora_current_kb')
localStorage.removeItem('weknora_selected_tenant_id')
localStorage.removeItem('weknora_selected_tenant_name')
localStorage.removeItem('weknora_memberships')
localStorage.removeItem('weknora_lite_mode')
localStorage.removeItem('academy_user')
localStorage.removeItem('academy_tenant')
localStorage.removeItem('academy_token')
localStorage.removeItem('academy_refresh_token')
localStorage.removeItem('academy_knowledge_bases')
localStorage.removeItem('academy_current_kb')
localStorage.removeItem('academy_selected_tenant_id')
localStorage.removeItem('academy_selected_tenant_name')
localStorage.removeItem('academy_memberships')
localStorage.removeItem('academy_lite_mode')
isLiteMode.value = false
try {
sessionStorage.removeItem('weknora_lite_last_path')
sessionStorage.removeItem('academy_lite_last_path')
} catch {
/* ignore */
}
@@ -484,14 +484,14 @@ export const useAuthStore = defineStore('auth', () => {
const initFromStorage = () => {
// 从localStorage恢复状态
const storedUser = localStorage.getItem('weknora_user')
const storedTenant = localStorage.getItem('weknora_tenant')
const storedToken = localStorage.getItem('weknora_token')
const storedRefreshToken = localStorage.getItem('weknora_refresh_token')
const storedKnowledgeBases = localStorage.getItem('weknora_knowledge_bases')
const storedCurrentKb = localStorage.getItem('weknora_current_kb')
const storedSelectedTenantId = localStorage.getItem('weknora_selected_tenant_id')
const storedSelectedTenantName = localStorage.getItem('weknora_selected_tenant_name')
const storedUser = localStorage.getItem('academy_user')
const storedTenant = localStorage.getItem('academy_tenant')
const storedToken = localStorage.getItem('academy_token')
const storedRefreshToken = localStorage.getItem('academy_refresh_token')
const storedKnowledgeBases = localStorage.getItem('academy_knowledge_bases')
const storedCurrentKb = localStorage.getItem('academy_current_kb')
const storedSelectedTenantId = localStorage.getItem('academy_selected_tenant_id')
const storedSelectedTenantName = localStorage.getItem('academy_selected_tenant_name')
if (storedUser) {
try {
@@ -552,7 +552,7 @@ export const useAuthStore = defineStore('auth', () => {
}
}
const storedMemberships = localStorage.getItem('weknora_memberships')
const storedMemberships = localStorage.getItem('academy_memberships')
if (storedMemberships) {
try {
const parsed = JSON.parse(storedMemberships)
@@ -563,7 +563,7 @@ export const useAuthStore = defineStore('auth', () => {
}
}
isLiteMode.value = localStorage.getItem('weknora_lite_mode') === 'true'
isLiteMode.value = localStorage.getItem('academy_lite_mode') === 'true'
}
// 初始化时从localStorage恢复状态
+2 -2
View File
@@ -37,7 +37,7 @@ test('browser and web search selections are independent and persisted', () => {
store.toggleLocalBrowser(true)
assert.equal(store.isLocalBrowserEnabled, true)
assert.equal(store.settings.webSearchEnabled, true)
assert.equal(JSON.parse(items.get('WeKnora_settings')!).localBrowserEnabled, true)
assert.equal(JSON.parse(items.get('Academy_settings')!).localBrowserEnabled, true)
store.toggleWebSearch(false)
assert.equal(store.isLocalBrowserEnabled, true)
store.toggleWebSearch(true)
@@ -53,7 +53,7 @@ test('reasoning overrides belong to the session, restore on reload and never bec
assert.equal(store.reasoningEffortOverride, '')
store.reasoningEffortOverride = 'high'
store.toggleWebSearch(true)
assert.equal(JSON.stringify(JSON.parse(items.get('WeKnora_settings')!)).includes('high'), false)
assert.equal(JSON.stringify(JSON.parse(items.get('Academy_settings')!)).includes('high'), false)
store.hydrateSessionInputState({}, true)
assert.equal(store.reasoningEffortOverride, 'high', 'first send keeps the createChat choice')
store.restoreDefaultsIfSnapshotted()
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import { ref, watch } from 'vue'
import { useAuthStore } from './auth'
const RECENT_KEY_PREFIX = 'weknora_cmdk_recent'
const RECENT_KEY_PREFIX = 'academy_cmdk_recent'
const RECENT_LIMIT = 4
// recentKey scopes "recent searches" to the active (user, tenant) pair.
+1 -1
View File
@@ -9,7 +9,7 @@ import {
type SessionActivity,
} from './sessionActivityState'
const STORAGE_PREFIX = 'weknora:session-activity'
const STORAGE_PREFIX = 'academy:session-activity'
export const useSessionActivityStore = defineStore('sessionActivity', () => {
const entries = reactive<Record<string, SessionActivity>>({})
@@ -54,7 +54,7 @@ for (const state of [{ agent_enabled: true, knowledge_base_ids: [] }, emptySelec
test(`session hydration clears stale file, tag, and tool selections when saved lists are ${'knowledge_ids' in state ? 'empty' : 'omitted'}`, () => {
const store = useSettingsStore(createPinia())
selectDefaults(store)
const storedDefaults = items.get('WeKnora_settings')
const storedDefaults = items.get('Academy_settings')
store.hydrateSessionInputState(state)
@@ -67,7 +67,7 @@ for (const state of [{ agent_enabled: true, knowledge_base_ids: [] }, emptySelec
assert.deepEqual(store.getSuggestedQuestionsParams(), {
knowledge_base_ids: undefined, knowledge_ids: undefined, tag_scopes: undefined, limit: undefined,
})
assert.equal(items.get('WeKnora_settings'), storedDefaults, 'hydration must not overwrite browser defaults')
assert.equal(items.get('Academy_settings'), storedDefaults, 'hydration must not overwrite browser defaults')
store.restoreDefaultsIfSnapshotted()
assert.deepEqual(JSON.parse(JSON.stringify(store.settings)), JSON.parse(storedDefaults!))
})
+30 -30
View File
@@ -187,7 +187,7 @@ export const useSettingsStore = defineStore("settings", {
saveSettings(settings: Settings) {
this.settings = { ...settings };
// 保存到localStorage
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 获取设置
@@ -213,25 +213,25 @@ export const useSettingsStore = defineStore("settings", {
// 启用/禁用 Agent
toggleAgent(enabled: boolean) {
this.settings.isAgentEnabled = enabled;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 更新 Agent 配置
updateAgentConfig(config: Partial<AgentConfig>) {
this.settings.agentConfig = { ...this.settings.agentConfig, ...config };
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
updateConversationModels(models: Partial<ConversationModels>) {
const current = this.settings.conversationModels || defaultSettings.conversationModels;
this.settings.conversationModels = { ...current, ...models };
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 更新模型配置
updateModelConfig(config: Partial<ModelConfig>) {
this.settings.modelConfig = { ...this.settings.modelConfig, ...config };
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 添加模型
@@ -248,7 +248,7 @@ export const useSettingsStore = defineStore("settings", {
}
models.push(model);
this.settings.modelConfig[key] = models as any;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 更新模型
@@ -263,7 +263,7 @@ export const useSettingsStore = defineStore("settings", {
}
models[index] = { ...models[index], ...updates };
this.settings.modelConfig[key] = models as any;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
@@ -278,7 +278,7 @@ export const useSettingsStore = defineStore("settings", {
models[0].isDefault = true;
}
this.settings.modelConfig[key] = models as any;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 设置默认模型
@@ -287,26 +287,26 @@ export const useSettingsStore = defineStore("settings", {
const models = [...this.settings.modelConfig[key]] as ModelItem[];
models.forEach(m => m.isDefault = (m.id === modelId));
this.settings.modelConfig[key] = models as any;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 更新 Ollama 配置
updateOllamaConfig(config: Partial<OllamaConfig>) {
this.settings.ollamaConfig = { ...this.settings.ollamaConfig, ...config };
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 选择知识库(替换整个列表)
selectKnowledgeBases(kbIds: string[]) {
this.settings.selectedKnowledgeBases = kbIds;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 添加单个知识库
addKnowledgeBase(kbId: string) {
if (!this.settings.selectedKnowledgeBases.includes(kbId)) {
this.settings.selectedKnowledgeBases.push(kbId);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
@@ -314,13 +314,13 @@ export const useSettingsStore = defineStore("settings", {
removeKnowledgeBase(kbId: string) {
this.settings.selectedKnowledgeBases =
this.settings.selectedKnowledgeBases.filter((id: string) => id !== kbId);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 清空知识库选择
clearKnowledgeBases() {
this.settings.selectedKnowledgeBases = [];
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 获取选中的知识库列表
@@ -331,18 +331,18 @@ export const useSettingsStore = defineStore("settings", {
// 本机浏览器与联网搜索可独立选择。
toggleLocalBrowser(enabled: boolean) {
this.settings.localBrowserEnabled = enabled;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
toggleWebSearch(enabled: boolean) {
this.settings.webSearchEnabled = enabled;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 启用/禁用自动检查更新
toggleAutoCheckUpdate(enabled: boolean) {
this.settings.autoCheckUpdate = enabled;
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// File selection actions
@@ -350,7 +350,7 @@ export const useSettingsStore = defineStore("settings", {
if (!this.settings.selectedFiles) this.settings.selectedFiles = [];
if (!this.settings.selectedFiles.includes(fileId)) {
this.settings.selectedFiles.push(fileId);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
@@ -358,71 +358,71 @@ export const useSettingsStore = defineStore("settings", {
if (!this.settings.selectedFiles) return;
this.settings.selectedFiles = this.settings.selectedFiles.filter((id: string) => id !== fileId);
if (this.settings.selectedFileKbMap) delete this.settings.selectedFileKbMap[fileId];
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
clearFiles() {
this.settings.selectedFiles = [];
this.settings.selectedFileKbMap = {};
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
addTag(tag: { id: string; name: string; kbId: string; kbName?: string }) {
if (!this.settings.selectedTags) this.settings.selectedTags = [];
if (!this.settings.selectedTags.some(t => t.id === tag.id && t.kbId === tag.kbId)) {
this.settings.selectedTags.push(tag);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
removeTag(tagId: string, kbId?: string) {
if (!this.settings.selectedTags) return;
this.settings.selectedTags = this.settings.selectedTags.filter(t => !(t.id === tagId && (!kbId || t.kbId === kbId)));
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
clearTags() {
this.settings.selectedTags = [];
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
addMCPService(serviceId: string) {
if (!this.settings.selectedMCPServices) this.settings.selectedMCPServices = [];
if (!this.settings.selectedMCPServices.includes(serviceId)) {
this.settings.selectedMCPServices.push(serviceId);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
removeMCPService(serviceId: string) {
if (!this.settings.selectedMCPServices) return;
this.settings.selectedMCPServices = this.settings.selectedMCPServices.filter(id => id !== serviceId);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
addSkill(skillName: string) {
if (!this.settings.selectedSkills) this.settings.selectedSkills = [];
if (!this.settings.selectedSkills.includes(skillName)) {
this.settings.selectedSkills.push(skillName);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
}
},
removeSkill(skillName: string) {
if (!this.settings.selectedSkills) return;
this.settings.selectedSkills = this.settings.selectedSkills.filter(name => name !== skillName);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
setFileKbMap(updates: Record<string, string>) {
if (!this.settings.selectedFileKbMap) this.settings.selectedFileKbMap = {};
Object.assign(this.settings.selectedFileKbMap, updates);
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
removeFileKbId(fileId: string) {
if (this.settings.selectedFileKbMap) delete this.settings.selectedFileKbMap[fileId];
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
getSelectedFiles(): string[] {
@@ -482,7 +482,7 @@ export const useSettingsStore = defineStore("settings", {
this.settings.selectedTags = [];
this.settings.selectedMCPServices = [];
this.settings.selectedSkills = [];
localStorage.setItem("WeKnora_settings", JSON.stringify(this.settings));
localStorage.setItem("Academy_settings", JSON.stringify(this.settings));
},
// 获取选中的智能体ID
+1 -1
View File
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import test from "node:test";
const SETTINGS_STORAGE_KEY = "WeKnora_settings";
const SETTINGS_STORAGE_KEY = "Academy_settings";
const BUILTIN_QUICK_ANSWER_ID = "builtin-quick-answer";
const BUILTIN_SMART_REASONING_ID = "builtin-smart-reasoning";
+2 -2
View File
@@ -1,7 +1,7 @@
import { safeRemoveItem, safeSetItem } from "@/composables/preferenceStorage";
import { reconcileBuiltinAgentMode } from "@/utils/agent-mode";
export const SETTINGS_STORAGE_KEY = "WeKnora_settings";
export const SETTINGS_STORAGE_KEY = "Academy_settings";
/** Deep-clone settings so nested arrays/objects are not shared with defaults. */
export function cloneSettings<T>(settings: T): T {
@@ -46,7 +46,7 @@ function resetStoredSettings<T extends ReconcilableSettings>(
reason: unknown,
): T {
console.error(
"[settings] Failed to parse WeKnora_settings from localStorage, resetting to defaults:",
"[settings] Failed to parse Academy_settings from localStorage, resetting to defaults:",
reason,
);
safeRemoveItem(SETTINGS_STORAGE_KEY);