Closed vladtar closed 1 month ago
[!NOTE]
Reviews paused
Use the following commands to manage reviews:
@coderabbitai resume
to resume automatic reviews.@coderabbitai review
to trigger a single review.
The changes introduce several enhancements to the AIAssistant component and related files. A new CSS rule is added for image handling, while the AIAssistant component is updated to support a new message type for images. The addToolMessage
function is replaced with a more flexible addMessage
function. Additionally, new tools are introduced to handle graph generation and file querying. The Chat component is also updated to handle the new "received-image" message type, allowing for image rendering within chat messages.
File | Change Summary |
---|---|
src/components/container/AIAssistant/AIAssistant.css |
Added CSS rule .mdhui-chat .image with height: 350px . |
src/components/container/AIAssistant/AIAssistant.tsx |
Expanded AIAssistantMessageType to include "image" , replaced addToolMessage with addMessage , updated ask method for async handling, modified logic for tool messages. |
src/components/presentational/Chat/Chat.tsx |
Updated ChatMessageType to include "received-image" , modified rendering logic to handle image messages. |
src/components/container/AIAssistant/AIAssistant.stories.tsx |
Added control property saveGraphImages and new story SaveGraphImages . |
src/helpers/AIAssistant/AIAssistant.ts |
Added GraphingTool , UploadedFileQueryTool , and GetUploadedFileTool to MyDataHelpsAIAssistant class. |
src/helpers/AIAssistant/Tools.ts |
Introduced GraphingTool , UploadedFileQueryTool , and GetUploadedFileTool with respective functionalities. |
sequenceDiagram
participant User
participant AIAssistant
participant Chat
participant GraphingTool
User->>AIAssistant: Send message
AIAssistant->>AIAssistant: Process message
AIAssistant->>GraphingTool: Generate image from Python code
GraphingTool->>AIAssistant: Return base64 image
AIAssistant->>Chat: Add message with type "received-image"
Chat->>User: Display image message
Hooked this up so that you can pass in an option to the AIAssistant
to save the generated graphs to your files. Still needs a lot of testing but putting it out there for feedback.
@vladtar Can I see a demo of this?
RE: Garmin, we only give options in the Type field for v2 queries (Fitbit and Apple only currently). So the LLM just makes up a non-existent Type some portion of the time. Furthermore, the shape of data is not always clear. Even if you tell the LLM that Garmin has a "Daily" Type, it still doesn't know that to get step data it can query for "Daily" ddps and look at result[n].properties["steps"]
for the step data.
(this is also an issue for the web view step copilot when making survey steps that load device data)
@coderabbitai pause
This is ready for a final look.
Yes, the "Save the graph" capability is a good suggestion I think I'm going to try to tackle that next. It will be interesting when to show the suggestions, perhaps some the first time the user starts interacting, then perhaps some different ones again after certain actions such as drawing a graph.
This is achieved via a new tool called
GraphingTool
that gets python code fromChatGPT
and executes it in a lambda sandbox.Security
REMINDER: All file contents are public.
Describe briefly what security risks you considered, why they don't apply, or how they've been mitigated.
Checklist
Testing
Documentation
Consider "Squash and merge" as needed to keep the commit history reasonable on
main
.Reviewers
Assign to the appropriate reviewer(s). Minimally, a second set of eyes is needed ensure no non-public information is published. Consider also including:
Summary by CodeRabbit
New Features
GraphingTool
to generate graphs from Python code and return them as images.AIAssistant
component with a new option to save graph images.AIAssistant
component to include new controls for image handling.Bug Fixes
Documentation