Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Theia AI] Terminal agent records its requests #14246

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Conversation

JonasHelming
Copy link
Contributor

fixed #14245

What it does

Terminal agent records its requests

How to test

Use the terminal agent and observe its requests being logged in the History View. Use a model with and one without structured output.

Follow-ups

Review checklist

Reminder for reviewers

fixed #14245

Signed-off-by: Jonas Helming <[email protected]>
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!
There was just a linting error. My suggestions inline should hopefully resolve those.

packages/ai-terminal/src/browser/ai-terminal-agent.ts Outdated Show resolved Hide resolved
Comment on lines 202 to 209
const responseText = JSON.stringify(parsedResult.data.commands);
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: responseText,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const responseText = JSON.stringify(parsedResult.data.commands);
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: responseText,
});
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: JSON.stringify(parsedResult.data.commands),
});

This is also to avoid the linting error:

@theia/ai-terminal: /home/runner/work/theia/theia/packages/ai-terminal/src/browser/ai-terminal-agent.ts
@theia/ai-terminal: 202:27 error 'responseText' is already declared in the upper scope on line 216 column 19
@typescript-eslint/no-shadow
@theia/ai-terminal:
@theia/ai-terminal: ✖ 1 problem (1 error, 0 warnings)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this before, but especially with GPT 3.5 it "hanged" sometimes. I guess the error in parsing is not thrown correctly then, could this be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happens only in the case below as in this case, the result is always pasrsable, but I wanted to make it consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the linting error with the new commit

Comment on lines 216 to 223
const responseText = JSON.stringify(jsonResult);
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: responseText
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const responseText = JSON.stringify(jsonResult);
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: responseText
});
this.recordingService.recordResponse({
agentId: this.id,
sessionId,
timestamp: Date.now(),
requestId,
response: JSON.stringify(jsonResult)
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this before, but especially with GPT 3.5 it "hanged" sometimes. I guess the error in parsing is not thrown correctly then, could this be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the linting error with the new commit

packages/ai-terminal/src/browser/ai-terminal-agent.ts Outdated Show resolved Hide resolved
@planger planger self-requested a review October 3, 2024 08:26
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me! 👍

@JonasHelming JonasHelming changed the title Terminal agent records its requests [Theia AI] Terminal agent records its requests Oct 3, 2024
@JonasHelming JonasHelming merged commit ce5e13f into master Oct 3, 2024
11 checks passed
@github-actions github-actions bot added this to the 1.55.0 milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Terminal agent doesn't record history (157)
2 participants