Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Aug 10, 2025

Important

Adds submitUserMessage method to Task class for submitting user messages to a webview, with tests for various scenarios.

  • Behavior:
    • Adds submitUserMessage method to Task class in Task.ts to submit user messages to a webview.
    • Handles empty messages by not sending them.
    • Logs an error if the provider reference is lost.
  • Interfaces:
    • Adds submitUserMessage to TaskLike interface in task.ts.
  • Tests:
    • Adds tests in Task.spec.ts to verify submitUserMessage behavior, including handling of empty messages and undefined providers.
  • Versioning:
    • Updates version in package.json from 1.44.0 to 1.45.0.

This description was created by Ellipsis for f877d30. You can customize this summary. It will automatically update as commits are pushed.

@mrubens mrubens requested review from cte and jr as code owners August 10, 2025 07:03
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 10, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the changes and found this to be a well-implemented feature. The code is clean, properly tested, and follows established patterns. I have a few minor suggestions for improvement.


public submitUserMessage(text: string, images?: string[]): void {
try {
const trimmed = (text ?? "").trim()
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider simplifying the null handling here. You're using text ?? "" but then checking !trimmed. This could be simplified:

Suggested change
const trimmed = (text ?? "").trim()
const trimmed = text?.trim() || ""
const imgs = images || []
if (!trimmed && imgs.length === 0) {
return
}

This would be more consistent with how you handle the images parameter.

this.askResponseImages = images
}

public submitUserMessage(text: string, images?: string[]): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding JSDoc documentation for this public method to maintain consistency with other public methods and improve IDE tooltips:

Suggested change
public submitUserMessage(text: string, images?: string[]): void {
/**
* Submits a user message to the webview.
* @param text - The message text to submit
* @param images - Optional array of image paths to include with the message
*/
public submitUserMessage(text: string, images?: string[]): void {

expect(noModelTask.apiConfiguration.apiProvider).toBe("openai")
})
})

Copy link
Contributor

Choose a reason for hiding this comment

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

Good test coverage! Consider adding one more test case for completeness - testing the scenario where only images are provided without text:

it("should handle images-only messages", async () => {
  const task = new Task({
    provider: mockProvider,
    apiConfiguration: mockApiConfig,
    task: "initial task",
    startTask: false,
  })

  // Call with images but no text
  task.submitUserMessage("", ["image1.png", "image2.png"])

  // Should not call postMessageToWebview since text is empty
  expect(mockProvider.postMessageToWebview).not.toHaveBeenCalled()
})

This would ensure the edge case is explicitly tested, even though the current implementation handles it correctly.

@mrubens mrubens merged commit f53fd39 into main Aug 10, 2025
9 checks passed
@mrubens mrubens deleted the add_submit_user_message branch August 10, 2025 07:13
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 10, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants