Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔥 refactor(chat): remove reInvokeToolMessage client re-invoke chain (#20179)

Arvin Xu3ed68d0931a3
diff --git a/locales/ar/plugin.json b/locales/ar/plugin.json
index f982076f662..ff069601369 100644
--- a/locales/ar/plugin.json
+++ b/locales/ar/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "تحقق من مصدر المهارة. يمكنك تعطيلها أو إزالتها في أي وقت من الإعدادات.",
"search.config.addKey": "إضافة مفتاح",
"search.config.close": "إزالة",
- "search.config.confirm": "تم، أعد المحاولة",
"search.crawPages.crawling": "جارٍ تحديد الروابط",
"search.crawPages.detail.preview": "معاينة",
"search.crawPages.detail.raw": "نص خام",
diff --git a/locales/bg-BG/plugin.json b/locales/bg-BG/plugin.json
index d61406accd9..7f3a624cde6 100644
--- a/locales/bg-BG/plugin.json
+++ b/locales/bg-BG/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Проверете източника на умението. Може да бъде деактивирано или премахнато по всяко време от настройките.",
"search.config.addKey": "Добави ключ",
"search.config.close": "Премахни",
- "search.config.confirm": "Готово, опитай отново",
"search.crawPages.crawling": "Идентифициране на връзки",
"search.crawPages.detail.preview": "Преглед",
"search.crawPages.detail.raw": "Суров текст",
diff --git a/locales/de-DE/plugin.json b/locales/de-DE/plugin.json
index dbdf35e1b9f..ed83488a665 100644
--- a/locales/de-DE/plugin.json
+++ b/locales/de-DE/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Skill-Quelle überprüfen. Kann jederzeit in den Einstellungen deaktiviert oder entfernt werden.",
"search.config.addKey": "Schlüssel hinzufügen",
"search.config.close": "Entfernen",
- "search.config.confirm": "Fertig, erneut versuchen",
"search.crawPages.crawling": "Links werden identifiziert",
"search.crawPages.detail.preview": "Vorschau",
"search.crawPages.detail.raw": "Rohtext",
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 0f9e97af822..602c957110f 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -876,7 +876,6 @@
"protocolInstall.warning": "Verify the Skill source. Disable or remove anytime in settings.",
"search.config.addKey": "Add key",
"search.config.close": "Remove",
- "search.config.confirm": "Done, retry",
"search.crawPages.crawling": "Identifying links",
"search.crawPages.detail.preview": "Preview",
"search.crawPages.detail.raw": "Raw text",
diff --git a/locales/es-ES/plugin.json b/locales/es-ES/plugin.json
index 9fe0d8ac8e5..d10a627444a 100644
--- a/locales/es-ES/plugin.json
+++ b/locales/es-ES/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Verifica la fuente del Skill. Puedes desactivarlo o eliminarlo en la configuración.",
"search.config.addKey": "Agregar clave",
"search.config.close": "Eliminar",
- "search.config.confirm": "Listo, reintentar",
"search.crawPages.crawling": "Identificando enlaces",
"search.crawPages.detail.preview": "Vista previa",
"search.crawPages.detail.raw": "Texto sin formato",
diff --git a/locales/fa-IR/plugin.json b/locales/fa-IR/plugin.json
index 791cd721eed..fde00412f50 100644
--- a/locales/fa-IR/plugin.json
+++ b/locales/fa-IR/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "منبع مهارت را بررسی کنید. در هر زمان می‌توانید آن را غیرفعال یا حذف کنید.",
"search.config.addKey": "افزودن کلید",
"search.config.close": "حذف",
- "search.config.confirm": "انجام شد، تلاش مجدد",
"search.crawPages.crawling": "در حال شناسایی لینک‌ها",
"search.crawPages.detail.preview": "پیش‌نمایش",
"search.crawPages.detail.raw": "متن خام",
diff --git a/locales/fr-FR/plugin.json b/locales/fr-FR/plugin.json
index 10eb5cef386..815cdb53166 100644
--- a/locales/fr-FR/plugin.json
+++ b/locales/fr-FR/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Vérifiez la source de la compétence. Vous pouvez la désactiver ou la supprimer à tout moment dans les paramètres.",
"search.config.addKey": "Ajouter une clé",
"search.config.close": "Supprimer",
- "search.config.confirm": "Terminé, réessayer",
"search.crawPages.crawling": "Identification des liens",
"search.crawPages.detail.preview": "Aperçu",
"search.crawPages.detail.raw": "Texte brut",
diff --git a/locales/it-IT/plugin.json b/locales/it-IT/plugin.json
index a4b0d55e864..b169ced3139 100644
--- a/locales/it-IT/plugin.json
+++ b/locales/it-IT/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Verifica la fonte della Skill. Puoi disattivarla o rimuoverla in qualsiasi momento dalle impostazioni.",
"search.config.addKey": "Aggiungi chiave",
"search.config.close": "Rimuovi",
- "search.config.confirm": "Fatto, riprova",
"search.crawPages.crawling": "Identificazione dei link",
"search.crawPages.detail.preview": "Anteprima",
"search.crawPages.detail.raw": "Testo grezzo",
diff --git a/locales/ja-JP/plugin.json b/locales/ja-JP/plugin.json
index 45819cd9bcb..1adbdc5b8ee 100644
--- a/locales/ja-JP/plugin.json
+++ b/locales/ja-JP/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "⚠️ このスキルの出所を信頼していることを確認してください。悪意のあるスキルはシステムの安全を脅かす可能性があります。",
"search.config.addKey": "キーを追加",
"search.config.close": "削除",
- "search.config.confirm": "設定完了し再試行",
"search.crawPages.crawling": "リンク認識中",
"search.crawPages.detail.preview": "プレビュー",
"search.crawPages.detail.raw": "生テキスト",
diff --git a/locales/ko-KR/plugin.json b/locales/ko-KR/plugin.json
index 2c7b766577d..ca23fb7133b 100644
--- a/locales/ko-KR/plugin.json
+++ b/locales/ko-KR/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "⚠️ 이 기능의 출처를 신뢰할 수 있는지 확인해 주세요. 악성 기능은 시스템 보안에 위협이 될 수 있습니다.",
"search.config.addKey": "API 키 추가",
"search.config.close": "삭제",
- "search.config.confirm": "설정 완료 및 재시도",
"search.crawPages.crawling": "링크 분석 중",
"search.crawPages.detail.preview": "미리보기",
"search.crawPages.detail.raw": "원본 텍스트",
diff --git a/locales/nl-NL/plugin.json b/locales/nl-NL/plugin.json
index 18c4fa00024..fc496b3ca27 100644
--- a/locales/nl-NL/plugin.json
+++ b/locales/nl-NL/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Controleer de bron van de Skill. U kunt deze op elk moment uitschakelen of verwijderen via de instellingen.",
"search.config.addKey": "Sleutel toevoegen",
"search.config.close": "Verwijderen",
- "search.config.confirm": "Gereed, opnieuw proberen",
"search.crawPages.crawling": "Links identificeren",
"search.crawPages.detail.preview": "Voorbeeld",
"search.crawPages.detail.raw": "Ruwe tekst",
diff --git a/locales/pl-PL/plugin.json b/locales/pl-PL/plugin.json
index f15bbfcc827..14b6efa8dbe 100644
--- a/locales/pl-PL/plugin.json
+++ b/locales/pl-PL/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Zweryfikuj źródło Umiejętności. Możesz ją wyłączyć lub usunąć w ustawieniach.",
"search.config.addKey": "Dodaj klucz",
"search.config.close": "Usuń",
- "search.config.confirm": "Gotowe, spróbuj ponownie",
"search.crawPages.crawling": "Identyfikowanie linków",
"search.crawPages.detail.preview": "Podgląd",
"search.crawPages.detail.raw": "Surowy tekst",
diff --git a/locales/pt-BR/plugin.json b/locales/pt-BR/plugin.json
index 36abcc703d7..9c03d585c0d 100644
--- a/locales/pt-BR/plugin.json
+++ b/locales/pt-BR/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Verifique a fonte da habilidade. Você pode desativá-la ou removê-la a qualquer momento nas configurações.",
"search.config.addKey": "Adicionar chave",
"search.config.close": "Remover",
- "search.config.confirm": "Concluído, tentar novamente",
"search.crawPages.crawling": "Identificando links",
"search.crawPages.detail.preview": "Pré-visualização",
"search.crawPages.detail.raw": "Texto bruto",
diff --git a/locales/ru-RU/plugin.json b/locales/ru-RU/plugin.json
index 166267f7c59..1788ecb047f 100644
--- a/locales/ru-RU/plugin.json
+++ b/locales/ru-RU/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Проверьте источник навыка. Вы можете отключить или удалить его в настройках.",
"search.config.addKey": "Добавить ключ",
"search.config.close": "Удалить",
- "search.config.confirm": "Готово, повторить",
"search.crawPages.crawling": "Определение ссылок",
"search.crawPages.detail.preview": "Предпросмотр",
"search.crawPages.detail.raw": "Исходный текст",
diff --git a/locales/tr-TR/plugin.json b/locales/tr-TR/plugin.json
index 9cfba013b7b..f5eb88043ca 100644
--- a/locales/tr-TR/plugin.json
+++ b/locales/tr-TR/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Skill kaynağını doğrulayın. Ayarlardan istediğiniz zaman devre dışı bırakabilir veya kaldırabilirsiniz.",
"search.config.addKey": "Anahtar ekle",
"search.config.close": "Kaldır",
- "search.config.confirm": "Tamam, tekrar dene",
"search.crawPages.crawling": "Bağlantılar belirleniyor",
"search.crawPages.detail.preview": "Önizleme",
"search.crawPages.detail.raw": "Ham metin",
diff --git a/locales/vi-VN/plugin.json b/locales/vi-VN/plugin.json
index abf28235c9b..114a9478d1a 100644
--- a/locales/vi-VN/plugin.json
+++ b/locales/vi-VN/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "Hãy xác minh nguồn Kỹ năng. Có thể tắt hoặc xóa bất kỳ lúc nào trong cài đặt.",
"search.config.addKey": "Thêm khóa",
"search.config.close": "Xóa",
- "search.config.confirm": "Xong, thử lại",
"search.crawPages.crawling": "Đang xác định liên kết",
"search.crawPages.detail.preview": "Xem trước",
"search.crawPages.detail.raw": "Văn bản gốc",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index d0688e00dc2..1e42929b0ee 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -876,7 +876,6 @@
"protocolInstall.warning": "安装前请确认你信任此技能的来源。你随时可以在设置中禁用或移除",
"search.config.addKey": "添加秘钥",
"search.config.close": "删除",
- "search.config.confirm": "已完成配置并重试",
"search.crawPages.crawling": "链接识别中",
"search.crawPages.detail.preview": "预览",
"search.crawPages.detail.raw": "原始文本",
diff --git a/locales/zh-TW/plugin.json b/locales/zh-TW/plugin.json
index 70c814f1f64..637dd0ffcc1 100644
--- a/locales/zh-TW/plugin.json
+++ b/locales/zh-TW/plugin.json
@@ -872,7 +872,6 @@
"protocolInstall.warning": "⚠️ 請確認您信任此插件的來源,惡意插件可能會危害您的系統安全。",
"search.config.addKey": "添加密鑰",
"search.config.close": "刪除",
- "search.config.confirm": "已完成配置並重試",
"search.crawPages.crawling": "連結識別中",
"search.crawPages.detail.preview": "預覽",
"search.crawPages.detail.raw": "原始文本",
diff --git a/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/index.tsx b/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/index.tsx
index f5d5abd6546..adcfe75ea02 100644
--- a/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/index.tsx
+++ b/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/index.tsx
@@ -1,6 +1,6 @@
import { Center, Flexbox } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
-import { memo, useMemo, useState } from 'react';
+import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useChatStore } from '@/store/chat';
@@ -16,9 +16,7 @@ interface ConfigAlertProps {
const ConfigAlert = memo<ConfigAlertProps>(({ provider, id }) => {
const { t } = useTranslation('plugin');
- const [resend, deleteMessage] = useChatStore((s) => [s.reInvokeToolMessage, s.deleteMessage]);
-
- const [loading, setLoading] = useState(false);
+ const deleteMessage = useChatStore((s) => s.deleteMessage);
const avatar = useMemo(() => {
switch (provider) {
@@ -38,20 +36,6 @@ const ConfigAlert = memo<ConfigAlertProps>(({ provider, id }) => {
<Flexbox gap={12} width={'100%'}>
<Button
block
- disabled={loading}
- style={{ marginTop: 8 }}
- type={'primary'}
- onClick={async () => {
- setLoading(true);
- resend(id).then(() => {
- setLoading(false);
- });
- // deleteMessage(id);
- }}
- >
- {t('search.config.confirm')}
- </Button>
- <Button
onClick={() => {
deleteMessage(id);
}}
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index ce047740b23..d5666adf5b5 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -895,7 +895,6 @@ export default {
'protocolInstall.warning': 'Verify the Skill source. Disable or remove anytime in settings.',
'search.config.addKey': 'Add key',
'search.config.close': 'Remove',
- 'search.config.confirm': 'Done, retry',
'search.crawPages.crawling': 'Identifying links',
'search.crawPages.detail.preview': 'Preview',
'search.crawPages.detail.raw': 'Raw text',
diff --git a/src/features/Conversation/store/slices/generation/action.ts b/src/features/Conversation/store/slices/generation/action.ts
index f8f02d839a8..e98a64c7623 100644
--- a/src/features/Conversation/store/slices/generation/action.ts
+++ b/src/features/Conversation/store/slices/generation/action.ts
@@ -685,12 +685,6 @@ export interface GenerationAction {
*/
regenerateUserMessage: (messageId: string) => Promise<void>;
- /**
- * Re-invoke a tool message
- * @deprecated Temporary bridge to ChatStore
- */
- reInvokeToolMessage: (messageId: string) => Promise<void>;
-
/**
* Resend a thread message
*/
@@ -1163,11 +1157,6 @@ export const generationSlice: StateCreator<
chatStore.openThreadCreator(messageId);
},
- reInvokeToolMessage: async (messageId: string) => {
- const chatStore = useChatStore.getState();
- await chatStore.reInvokeToolMessage(messageId);
- },
-
internal_beginHeteroOverloadWait: (scopeId: string) => {
const chatStore = useChatStore.getState();
const existingId = get().heteroOverloadWaitOpIds[scopeId];
diff --git a/src/store/chat/agents/__tests__/clientRuntimeExecutors/fixtures/mockStore.ts b/src/store/chat/agents/__tests__/clientRuntimeExecutors/fixtures/mockStore.ts
index 4b6c91ef25e..3aa90a963ce 100644
--- a/src/store/chat/agents/__tests__/clientRuntimeExecutors/fixtures/mockStore.ts
+++ b/src/store/chat/agents/__tests__/clientRuntimeExecutors/fixtures/mockStore.ts
@@ -107,8 +107,6 @@ export const createMockStore = (overrides: Partial<ChatStore> = {}): ChatStore =
optimisticUpdateMessagePlugin: vi.fn().mockResolvedValue(undefined),
- optimisticUpdateMessagePluginError: vi.fn().mockResolvedValue(undefined),
-
optimisticUpdatePluginArguments: vi.fn().mockResolvedValue(undefined),
optimisticUpdatePluginState: vi.fn().mockResolvedValue(undefined),
diff --git a/src/store/chat/slices/message/actions/optimisticUpdate.ts b/src/store/chat/slices/message/actions/optimisticUpdate.ts
index 8eda146af8e..5b9b58b7b94 100644
--- a/src/store/chat/slices/message/actions/optimisticUpdate.ts
+++ b/src/store/chat/slices/message/actions/optimisticUpdate.ts
@@ -1,7 +1,6 @@
import {
type ChatImageItem,
type ChatMessageError,
- type ChatMessagePluginError,
type ChatToolPayload,
type CreateMessageParams,
type GroundingSearch,
@@ -256,18 +255,6 @@ export class MessageOptimisticUpdateActionImpl {
}
};
- optimisticUpdateMessagePluginError = async (
- id: string,
- error: ChatMessagePluginError | null,
- context?: OptimisticUpdateContext,
- ): Promise<void> => {
- const ctx = this.#get().internal_getConversationContext(context);
- const result = await messageService.updateMessagePluginError(id, error, ctx);
- if (result?.success && result.messages) {
- this.#get().replaceMessages(result.messages, { context: ctx });
- }
- };
-
optimisticUpdateMessageRAG = async (
id: string,
data: UpdateMessageRAGParams,
diff --git a/src/store/chat/slices/plugin/action.test.ts b/src/store/chat/slices/plugin/action.test.ts
index 1e30daa868d..279012a5498 100644
--- a/src/store/chat/slices/plugin/action.test.ts
+++ b/src/store/chat/slices/plugin/action.test.ts
@@ -679,81 +679,6 @@ describe('ChatPluginAction', () => {
});
});
- describe('reInvokeToolMessage', () => {
- it('should re-invoke a tool message', async () => {
- const messageId = 'message-id';
- const message = {
- id: messageId,
- role: 'tool',
- content: 'Original content',
- plugin: {
- type: 'default',
- identifier: 'plugin-id',
- apiName: 'api-name',
- arguments: '{}',
- },
- tool_call_id: 'tool-id',
- } as UIChatMessage;
-
- const internal_invokeDifferentTypePluginMock = vi.fn();
- act(() => {
- useChatStore.setState({
- activeAgentId: 'session-id',
- messagesMap: { [messageMapKey({ agentId: 'session-id' })]: [message] },
- internal_invokeDifferentTypePlugin: internal_invokeDifferentTypePluginMock,
- optimisticUpdateMessagePluginError: vi.fn(),
- });
- });
-
- const { result } = renderHook(() => useChatStore());
-
- await act(async () => {
- await result.current.reInvokeToolMessage(messageId);
- });
-
- expect(internal_invokeDifferentTypePluginMock).toHaveBeenCalledWith(
- messageId,
- expect.objectContaining(message.plugin),
- );
- });
-
- it('should clear error content when re-invoking', async () => {
- const messageId = 'message-id';
- const message = {
- id: messageId,
- role: 'tool',
- content: 'Original content',
- plugin: {
- type: 'default',
- identifier: 'plugin-id',
- apiName: 'api-name',
- arguments: '{}',
- },
- tool_call_id: 'tool-id',
- pluginError: { message: 'Previous error', type: 'ProviderBizError' },
- } as UIChatMessage;
-
- const internal_updateMessageErrorMock = vi.fn();
-
- act(() => {
- useChatStore.setState({
- activeAgentId: 'session-id',
- messagesMap: { [messageMapKey({ agentId: 'session-id' })]: [message] },
- internal_invokeDifferentTypePlugin: vi.fn(),
- optimisticUpdateMessagePluginError: internal_updateMessageErrorMock,
- });
- });
-
- const { result } = renderHook(() => useChatStore());
-
- await act(async () => {
- await result.current.reInvokeToolMessage(messageId);
- });
-
- expect(internal_updateMessageErrorMock).toHaveBeenCalledWith(messageId, null, undefined);
- });
- });
-
describe('updatePluginArguments', () => {
it('should update plugin arguments and refresh messages', async () => {
const messageId = 'message-id';
diff --git a/src/store/chat/slices/plugin/actions/publicApi.ts b/src/store/chat/slices/plugin/actions/publicApi.ts
index e0b7f706c57..c89ad5707b6 100644
--- a/src/store/chat/slices/plugin/actions/publicApi.ts
+++ b/src/store/chat/slices/plugin/actions/publicApi.ts
@@ -3,8 +3,6 @@ import { type ChatToolPayload, type RuntimeStepContext } from '@lobechat/types';
import { type ChatStore } from '@/store/chat/store';
import { type StoreSetter } from '@/store/types';
-import { displayMessageSelectors } from '../../message/selectors';
-
/**
* Public API for plugin operations
* These methods are called by UI components or other business scenarios
@@ -23,24 +21,6 @@ export class PluginPublicApiActionImpl {
this.#get = get;
}
- reInvokeToolMessage = async (id: string): Promise<void> => {
- const message = displayMessageSelectors.getDisplayMessageById(id)(this.#get());
- if (!message || message.role !== 'tool' || !message.plugin) return;
-
- // Get operationId from messageOperationMap
- const operationId = this.#get().messageOperationMap[id];
- const context = operationId ? { operationId } : undefined;
-
- // if there is error content, then clear the error
- if (!!message.pluginError) {
- this.#get().optimisticUpdateMessagePluginError(id, null, context);
- }
-
- const payload: ChatToolPayload = { ...message.plugin, id: message.tool_call_id! };
-
- await this.#get().internal_invokeDifferentTypePlugin(id, payload);
- };
-
internal_invokeDifferentTypePlugin = async (
id: string,
payload: ChatToolPayload,