From 941a6666e61547280dac16bbca8d1d06805ab7fe Mon Sep 17 00:00:00 2001 From: icarus Date: Sun, 14 Sep 2025 05:59:08 +0800 Subject: [PATCH] feat(agents): implement add agent functionality and migration - Add migration for new agents structure (version 155) - Enable addAgent call in AddAgentModal - Update dependencies array with addAgent - Replace TODO comment with FIXME for model type issue --- src/renderer/src/components/Popups/AddAgentModal.tsx | 7 +++---- src/renderer/src/store/index.ts | 2 +- src/renderer/src/store/migrate.ts | 9 +++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/Popups/AddAgentModal.tsx b/src/renderer/src/components/Popups/AddAgentModal.tsx index d846bc7a19..8dab9835c7 100644 --- a/src/renderer/src/components/Popups/AddAgentModal.tsx +++ b/src/renderer/src/components/Popups/AddAgentModal.tsx @@ -57,7 +57,6 @@ export const AddAgentModal: React.FC = () => { const { t } = useTranslation() const loadingRef = useRef(false) const { setTimeoutTimer } = useTimer() - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { addAgent } = useAgents() // default values. may change to undefined. @@ -208,14 +207,14 @@ export const AddAgentModal: React.FC = () => { model: form.model } satisfies AgentEntity logger.debug('Agent', agent) - // addAgent(agent) + addAgent(agent) window.toast.success(t('common.add_success')) loadingRef.current = false setTimeoutTimer('onCreateAgent', () => EventEmitter.emit(EVENT_NAMES.SHOW_ASSISTANTS), 0) onClose() }, - [form.type, form.model, form.name, form.description, form.instructions, t, setTimeoutTimer, onClose] + [form.type, form.model, form.name, form.description, form.instructions, addAgent, t, setTimeoutTimer, onClose] ) return ( @@ -250,7 +249,7 @@ export const AddAgentModal: React.FC = () => { )} - {/* Model type definition is string. It cannot be related to provider. Just mock a model now. */} + {/* FIXME: Model type definition is string. It cannot be related to provider. Just mock a model now. */}