Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/core/src/ai-model/models/auto-glm/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function parseAutoGLMPlanningAction(response: {

if (trimmedResponse.startsWith('finish(message=')) {
let message = extractValueAfter(trimmedResponse, 'finish(message="');
if (message.endsWith(')')) message = message.slice(0, -1);
if (!trimmedResponse.endsWith('")') && message.endsWith(')')) {
message = message.slice(0, -1);
}
return {
_metadata: 'finish',
message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ describe('parseAutoGLMPlanningAction', () => {
expect(finishAction.message).toBe('Task completed');
});

it('should keep a closing parenthesis at the end of the Finish message', () => {
const action = parseAutoGLMPlanningAction({
think: 'All done',
content: 'finish(message="Deleted 3 items (all done)")',
});
expect((action as FinishAction).message).toBe('Deleted 3 items (all done)');
});

it('should parse Interact action', () => {
const action = parseAutoGLMPlanningAction({
think: 'Need interaction',
Expand Down