新增: AI Chat多项增强(审批去重/编辑重发/导出/实体引用/会话置顶搜索)+任务推进链df-nodes落地
This commit is contained in:
@@ -266,6 +266,17 @@
|
||||
@change="syncConcurrencyConfig" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{{ $t('settings.labelAgentMaxIterations') }}</span>
|
||||
<span class="setting-desc">{{ $t('settings.descAgentMaxIterations') }}</span>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<input type="number" class="setting-select" min="1" max="50" style="width:80px"
|
||||
v-model.number="settings.agentMaxIterations"
|
||||
@change="syncAgentMaxIterations" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -613,6 +624,8 @@ const settings = reactive({
|
||||
showTokenUsage: appSettings.get<boolean>('df-show-token-usage', false),
|
||||
llmGlobalConcurrency: appSettings.get<number>('df-llm-global-concurrency', 3),
|
||||
llmPerConvConcurrency: appSettings.get<number>('df-llm-per-conv-concurrency', 2),
|
||||
// F-260616-01: Agentic 循环最大轮次,默认 10(与后端 DEFAULT_MAX_AGENT_ITERATIONS 对齐)
|
||||
agentMaxIterations: appSettings.get<number>('df-ai-agent-max-iterations', 10),
|
||||
})
|
||||
|
||||
function applyTheme(theme: string) {
|
||||
@@ -647,6 +660,10 @@ watch(() => settings.llmPerConvConcurrency, (v) => {
|
||||
void appSettings.set('df-llm-per-conv-concurrency', v)
|
||||
})
|
||||
|
||||
watch(() => settings.agentMaxIterations, (v) => {
|
||||
void appSettings.set('df-ai-agent-max-iterations', v)
|
||||
})
|
||||
|
||||
// 同步 LLM 并发上限到后端(debounce 300ms,防快速连续调整时频繁 IPC)
|
||||
// 持久化已由上方 watch 写 appSettings(SQLite) 完成;此处只负责同步内存限流器
|
||||
let _concurrencyTimer: ReturnType<typeof setTimeout> | null = null
|
||||
@@ -669,6 +686,24 @@ function syncConcurrencyConfig() {
|
||||
}, 300)
|
||||
}
|
||||
|
||||
// 同步 Agentic 最大轮次到后端(debounce 300ms)
|
||||
// F-260616-01: 后端 loop 入口 load 快照锁定边界——热改后当前 loop 不受影响,
|
||||
// 下次发消息才生效(与 llm_concurrency 传 Arc 实时反映的区别)。
|
||||
// 双 clamp:此处 1-50 + 后端 command 再 clamp 1-50,防越界输入致 loop 失效/失控
|
||||
let _agentIterTimer: ReturnType<typeof setTimeout> | null = null
|
||||
function syncAgentMaxIterations() {
|
||||
// clamp 1-50,防越界(过小致 agent 失能、过大致烧 token)
|
||||
settings.agentMaxIterations = Math.min(50, Math.max(1, settings.agentMaxIterations || 10))
|
||||
if (_agentIterTimer) clearTimeout(_agentIterTimer)
|
||||
_agentIterTimer = setTimeout(async () => {
|
||||
try {
|
||||
await aiApi.setAgentMaxIterations(settings.agentMaxIterations)
|
||||
} catch (e) {
|
||||
console.error('同步 Agent 最大轮次失败:', e)
|
||||
}
|
||||
}, 300)
|
||||
}
|
||||
|
||||
watch(() => settings.language, (val) => {
|
||||
void appSettings.set('df-language', val)
|
||||
// 同步 i18n 实例,让界面立即跟随语言切换
|
||||
@@ -735,11 +770,14 @@ onMounted(() => {
|
||||
loadKnowledgeConfig()
|
||||
// 启动同步一次 LLM 并发配置(防刷新页面后后端未恢复用户设定值)
|
||||
syncConcurrencyConfig()
|
||||
// F-260616-01: 启动同步一次 Agentic 最大轮次(防刷新页面后后端未恢复用户设定值)
|
||||
syncAgentMaxIterations()
|
||||
})
|
||||
|
||||
// 组件卸载清全部 debounce timer,防 unmount 后旧 timer 仍 fire 写已销毁 reactive(timer 泄漏 FR-C3)
|
||||
onUnmounted(() => {
|
||||
if (_concurrencyTimer) clearTimeout(_concurrencyTimer)
|
||||
if (_agentIterTimer) clearTimeout(_agentIterTimer)
|
||||
if (_knowledgeSaveTimer) clearTimeout(_knowledgeSaveTimer)
|
||||
if (_toastTimer) clearTimeout(_toastTimer)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user