Compare commits

...

2 Commits

Author SHA1 Message Date
arvinxx 805783d65b update tool error 2026-02-01 18:01:54 +08:00
arvinxx 9fdebe3eac improve tasks 2026-02-01 13:41:41 +08:00
7 changed files with 64 additions and 8 deletions
+1
View File
@@ -189,6 +189,7 @@
"builtins.lobe-web-browsing.title": "Web Search",
"confirm": "Confirm",
"debug.arguments": "Arguments",
"debug.error": "Error",
"debug.function_call": "Function call",
"debug.intervention": "Skill intervention",
"debug.off": "Debug off",
+1
View File
@@ -189,6 +189,7 @@
"builtins.lobe-web-browsing.title": "联网搜索",
"confirm": "确认",
"debug.arguments": "调用参数",
"debug.error": "错误信息",
"debug.function_call": "函数调用",
"debug.intervention": "技能干预",
"debug.off": "关闭调试",
@@ -1,6 +1,7 @@
import { type ToolIntervention } from '@lobechat/types';
import { Block, Highlighter, Icon, Tabs, type TabsProps } from '@lobehub/ui';
import {
AlertTriangleIcon,
BracesIcon,
FunctionSquareIcon,
HandIcon,
@@ -117,8 +118,31 @@ const Debug = memo<DebugProps>(
key: 'intervention',
label: t('debug.intervention'),
},
{
children: (
<Highlighter
language={'json'}
style={{ background: 'transparent', borderRadius: 0, height: '100%' }}
variant={'filled'}
>
{JSON.stringify(result?.error, null, 2)}
</Highlighter>
),
icon: <Icon icon={AlertTriangleIcon} />,
key: 'error',
label: t('debug.error'),
},
],
[
functionCall,
isJsonResult,
params,
result?.content,
result?.state,
result?.error,
intervention,
t,
],
[functionCall, isJsonResult, params, result?.content, result?.state, intervention, t],
);
return (
@@ -97,8 +97,9 @@ const Render = memo<RenderProps>(
return null;
}
// Handle error state
if (result.error) {
// Handle PluginSettingsInvalid error - guide user to configure plugin
// Other errors are shown in Debug tab, no special render needed
if (result.error?.type === 'PluginSettingsInvalid') {
return (
<ErrorResponse
{...result.error}
@@ -20,10 +20,12 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
`,
paramKey: css`
font-family: ${cssVar.fontFamilyCode};
font-size: 12px;
color: ${cssVar.colorTextTertiary};
`,
paramValue: css`
font-family: ${cssVar.fontFamilyCode};
font-size: 12px;
color: ${cssVar.colorTextSecondary};
`,
root: css`
@@ -327,11 +327,37 @@ const TaskMessages = memo<TaskMessagesProps>(
const assistantGroupMessage = messages.find((item) => item.role === 'assistantGroup');
const userMessage = messages.find((item) => item.role === 'user');
return {
assistantId: assistantGroupMessage?.id ?? '',
blocks: assistantGroupMessage?.children ?? [],
instruction: userMessage?.content,
};
// If assistantGroup exists, use its children as blocks
if (assistantGroupMessage) {
return {
assistantId: assistantGroupMessage.id ?? '',
blocks: assistantGroupMessage.children ?? [],
instruction: userMessage?.content,
};
}
// Fallback: support plain assistant message (without tools)
// This handles cases where SubAgent returns a simple text response
const assistantMessage = messages.find((item) => item.role === 'assistant');
if (assistantMessage) {
// Convert plain assistant message to block format
const block: AssistantContentBlock = {
content: assistantMessage.content || '',
id: assistantMessage.id,
};
// Copy optional fields if they exist
if (assistantMessage.error) block.error = assistantMessage.error;
if (assistantMessage.reasoning) block.reasoning = assistantMessage.reasoning;
return {
assistantId: assistantMessage.id ?? '',
blocks: [block],
instruction: userMessage?.content,
};
}
return { assistantId: '', blocks: [], instruction: undefined };
}, [messages]);
// Calculate total tool calls
+1
View File
@@ -190,6 +190,7 @@ export default {
'builtins.lobe-web-browsing.title': 'Web Search',
'confirm': 'Confirm',
'debug.arguments': 'Arguments',
'debug.error': 'Error',
'debug.function_call': 'Function call',
'debug.intervention': 'Skill intervention',
'debug.off': 'Debug off',