feat(config): 添加配置文件支持动态标题和提示词
- 新增 public/config.json 配置文件,包含网站标题、副标题及任务提示词 - 在 Header 组件中读取并应用配置中的标题信息-为 Task 组件的搜索建议框引入配置中的提示词列表 - 创建 useConfigStore 管理全局配置状态,并在应用初始化时加载配置 - 更新 main.ts 在应用启动时设置文档标题 - 移除了 Task.vue 中硬编码的提示词数组,改由配置驱动-修复了 agents store 中版本标识监听逻辑,实现存储清理功能 - 添加 MultiLineTooltip 组件用于文本溢出时显示完整内容 -重构 TaskSyllabus 页面布局与样式,提升视觉效果与交互体验 - 引入 Bg
This commit is contained in:
39
src/stores/modules/config.ts
Normal file
39
src/stores/modules/config.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { readConfig } from '@/utils/readJson.ts'
|
||||
import { store } from '@/stores'
|
||||
|
||||
export interface Config {
|
||||
title: string
|
||||
subTitle: string
|
||||
centerTitle: string
|
||||
taskPromptWords: string[]
|
||||
agentRepository: {
|
||||
storageVersionIdentifier: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const useConfigStore = defineStore('config', () => {
|
||||
const config = ref<Config>({} as Config)
|
||||
|
||||
// 异步调用readConfig
|
||||
async function initConfig() {
|
||||
config.value = await readConfig<Config>('config.json')
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
config,
|
||||
initConfig
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 用于在组件外部(如在Pinia Store 中)使用 Pinia 提供的 store 实例。
|
||||
* 官方文档解释了如何在组件外部使用 Pinia Store:
|
||||
* https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component
|
||||
*/
|
||||
export function useConfigStoreHook() {
|
||||
return useConfigStore(store)
|
||||
}
|
||||
Reference in New Issue
Block a user