Skip to content

Commit 956e451

Browse files
committed
fix(ui-tars): set error message on GUIAgent's onError callback
1 parent 917b287 commit 956e451

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

apps/ui-tars/src/main/services/runAgent.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const runAgent = async (
6363
}) => {
6464
const lastConv = getState().messages[getState().messages.length - 1];
6565
const { status, conversations, ...restUserData } = data;
66-
logger.info('[status]', status, conversations.length);
66+
logger.info('[onGUIAgentData] status', status, conversations.length);
6767

6868
// add SoM to conversations
6969
const conversationsWithSoM: ConversationWithSoM[] = await Promise.all(
@@ -102,7 +102,7 @@ export const runAgent = async (
102102
...rest
103103
} = conversationsWithSoM?.[conversationsWithSoM.length - 1] || {};
104104
logger.info(
105-
'======data======\n',
105+
'[onGUIAgentData] ======data======\n',
106106
predictionParsed,
107107
screenshotContext,
108108
rest,
@@ -166,7 +166,12 @@ export const runAgent = async (
166166
operator: operator,
167167
onData: handleData,
168168
onError: ({ error }) => {
169-
logger.error('[runAgent error]', settings, error);
169+
logger.error('[onGUIAgentError]', settings, error);
170+
setState({
171+
...getState(),
172+
status: StatusEnum.ERROR,
173+
errorMsg: JSON.stringify(error),
174+
});
170175
},
171176
retry: {
172177
model: {

0 commit comments

Comments
 (0)