Merge branch 'feat/agents-new' of https://github.com/CherryHQ/cherry-studio into feat/agents-new

This commit is contained in:
suyao 2025-09-22 14:42:41 +08:00
commit efa54f3435
No known key found for this signature in database
8 changed files with 20 additions and 17 deletions

View File

@ -22,7 +22,7 @@
}, },
"get": { "get": {
"error": { "error": {
"failed": "[to be translated]:Failed to get the agent." "failed": "Αποτυχία λήψης του πράκτορα."
} }
}, },
"list": { "list": {

View File

@ -27,7 +27,7 @@
}, },
"list": { "list": {
"error": { "error": {
"failed": "[to be translated]:Failed to list agents." "failed": "Échec de la liste des agents."
} }
}, },
"session": { "session": {

View File

@ -27,7 +27,7 @@
}, },
"list": { "list": {
"error": { "error": {
"failed": "[to be translated]:Failed to list agents." "failed": "Falha ao listar agentes."
} }
}, },
"session": { "session": {

View File

@ -60,7 +60,7 @@ const KnowledgeDirectories: FC<KnowledgeContentProps> = ({ selectedBase, progres
} }
const path = await window.api.file.selectFolder() const path = await window.api.file.selectFolder()
logger.info('Selected directory:', path) logger.info('Selected directory:', { path })
path && addDirectory(path) path && addDirectory(path)
} }

View File

@ -19,16 +19,26 @@ const assistantsSlice = createSlice({
initialState, initialState,
reducers: { reducers: {
setAssistantPresets: (state, action: PayloadAction<AssistantPreset[]>) => { setAssistantPresets: (state, action: PayloadAction<AssistantPreset[]>) => {
state.agents = action.payload const presets = action.payload
state.agents = []
presets.forEach((p) => {
state.agents.push(p)
})
}, },
addAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => { addAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => {
// @ts-ignore ts-2589 false positive
state.agents.push(action.payload) state.agents.push(action.payload)
}, },
removeAssistantPreset: (state, action: PayloadAction<{ id: string }>) => { removeAssistantPreset: (state, action: PayloadAction<{ id: string }>) => {
state.agents = state.agents.filter((c) => c.id !== action.payload.id) state.agents = state.agents.filter((c) => c.id !== action.payload.id)
}, },
updateAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => { updateAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => {
state.agents = state.agents.map((c) => (c.id === action.payload.id ? action.payload : c)) const preset = action.payload
state.agents.forEach((a) => {
if (a.id === preset.id) {
a = preset
}
})
}, },
updateAssistantPresetSettings: ( updateAssistantPresetSettings: (
state, state,

View File

@ -2465,15 +2465,6 @@ const migrateConfig = {
} }
}, },
'155': (state: RootState) => { '155': (state: RootState) => {
try {
state.agents.agentsNew = []
return state
} catch (error) {
logger.error('migrate 155 error', error as Error)
return state
}
},
'156': (state: RootState) => {
try { try {
state.knowledge.bases.forEach((base) => { state.knowledge.bases.forEach((base) => {
if ((base as any).framework) { if ((base as any).framework) {
@ -2486,7 +2477,7 @@ const migrateConfig = {
return state return state
} }
}, },
'157': (state: RootState) => { '156': (state: RootState) => {
try { try {
state.llm.providers.forEach((provider) => { state.llm.providers.forEach((provider) => {
if (provider.id === SystemProviderIds.anthropic) { if (provider.id === SystemProviderIds.anthropic) {
@ -2497,7 +2488,7 @@ const migrateConfig = {
}) })
return state return state
} catch (error) { } catch (error) {
logger.error('migrate 157 error', error as Error) logger.error('migrate 156 error', error as Error)
return state return state
} }
} }

View File

@ -102,6 +102,7 @@ export const messagesSlice = createSlice({
}, },
messagesReceived(state, action: PayloadAction<MessagesReceivedPayload>) { messagesReceived(state, action: PayloadAction<MessagesReceivedPayload>) {
const { topicId, messages } = action.payload const { topicId, messages } = action.payload
// @ts-ignore ts-2589 false positive
messagesAdapter.upsertMany(state, messages) messagesAdapter.upsertMany(state, messages)
state.messageIdsByTopic[topicId] = messages.map((m) => m.id) state.messageIdsByTopic[topicId] = messages.map((m) => m.id)
state.currentTopicId = topicId state.currentTopicId = topicId

View File

@ -150,6 +150,7 @@ const runtimeSlice = createSlice({
state.chat.selectedMessageIds = action.payload state.chat.selectedMessageIds = action.payload
}, },
setActiveTopic: (state, action: PayloadAction<Topic>) => { setActiveTopic: (state, action: PayloadAction<Topic>) => {
// @ts-ignore ts2589 false positive
state.chat.activeTopic = action.payload state.chat.activeTopic = action.payload
}, },
setActiveAgentId: (state, action: PayloadAction<string>) => { setActiveAgentId: (state, action: PayloadAction<string>) => {