feat: Agent 预设系统 - 一键切换角色/工作模式
- 内置 6 个预设:默认、翻译官、代码审查、写作助手、数据分析师、学习导师 - 每个预设包含:系统提示词、温度、上下文长度、Think 开关 - 预设栏胶囊按钮,点击即切换,自动应用全部配置 - 支持创建/编辑/删除自定义预设,IndexedDB 持久化 - 切换预设时同步设置面板 UI + toast 提示 - 温度参数集成到聊天 API 调用
This commit is contained in:
@@ -18,6 +18,8 @@ import { initInputArea } from './components/input-area.js';
|
||||
import { initSettingsModal, closeSettingsModal } from './components/settings-modal.js';
|
||||
import { initHistoryModal, closeHistoryModal } from './components/history-modal.js';
|
||||
import { initKBModal } from './components/kb-modal.js';
|
||||
import { initPresetBar, initPresetModal } from './components/preset-bar.js';
|
||||
import { initPresetManager } from './preset-manager.js';
|
||||
import { initVectorStore } from './rag.js';
|
||||
|
||||
function initHelpModal() {
|
||||
@@ -115,6 +117,8 @@ async function init() {
|
||||
initSettingsModal();
|
||||
initHistoryModal();
|
||||
initKBModal();
|
||||
initPresetBar();
|
||||
initPresetModal();
|
||||
initHelpModal();
|
||||
|
||||
// 5. 绑定全局事件
|
||||
@@ -127,6 +131,9 @@ async function init() {
|
||||
// 6.1 初始化向量存储
|
||||
await initVectorStore();
|
||||
|
||||
// 6.2 初始化预设管理器(会从 DB 加载并应用上次激活的预设)
|
||||
await initPresetManager();
|
||||
|
||||
// 7. 恢复上次选择的模型
|
||||
const savedModel = await db.getSetting('selectedModel', '');
|
||||
if (savedModel) {
|
||||
@@ -173,6 +180,9 @@ async function init() {
|
||||
initInputArea();
|
||||
initSettingsModal();
|
||||
initHistoryModal();
|
||||
initPresetBar();
|
||||
initPresetModal();
|
||||
initPresetManager();
|
||||
checkConnection().then(loadModels);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user