-
Couldn't load subscription status.
- Fork 55
Add a new WebTool: AI Chat WebTool #264
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces an AI Chat WebTool for Google Summer of Code 2025 that enables natural language control of ArduPilot vehicles through OpenAI's assistant API. The implementation builds upon prior work and integrates MAVLink communication for real-time vehicle control.
Key changes include:
- Creation of a complete chat interface with OpenAI integration for vehicle control commands
- Implementation of MAVLink messaging and parameter handling for vehicle communication
- Addition of voice-to-text functionality for hands-free operation
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Chat/index.html | Main application interface with chat UI, MAVLink integration, and OpenAI assistant functionality |
| Chat/style.css | CSS styling for user and assistant chat message bubbles |
| Chat/shared.js | Shared module for exporting MAVLink instances across components |
| Chat/mavlink_msgs.js | Auto-generated MAVLink message definitions and component mappings |
| Chat/Readme.md | Basic documentation describing the OpenAI-based chat module |
| Chat/MAVLink/mavlink_store.js | MAVLink message storage and retrieval system for caching vehicle data |
| Chat/MAVLink/local_modules/long/* | Local copy of the Long.js library for 64-bit integer operations |
…msg typo; changed label's for to match input id
- Added and Fixed functions to set, get, delete, and check wakeup timers - Implemented get_mode_mapping function - Fixed minor UI design issue - Updated handleTranscription to add FormData field language=en to enforce English in Whisper transcription
…UI change - Added case 22 in mavlink_msg_handler for handling PARAM_VALUE messages - Converted handle_function_call to async - Added functions for use in handle_function_call: - get_parameter - get_all_parameters - get_parameter_description - set_parameter - get_mavlink_message - get_available_mavlink_messages - Made small UI adjustments - Made small UI adjustments
…perties of null (reading 'apiKey') Added a new “Connect AI” button so users can initialize the assistant before sending messages Linked the button to the connection routine and exposed the function globally for other modules Updated audio transcription to ensure a connection to OpenAI exists before sending the audio for processing
- Add "Start New Chat" button and support for restoring previous chat sessions with thread id - Display prompt to continue or reset previous sessions on page load - Introduce chat busy state to prevent race conditions; disable UI controls during chat operations - Remove unnecessary functions for arming/disarming vehicle - Enhance parameter metadata loading - Clean up labels, error handling, and general code structure
|
@esatiyev We can add tool in the Development section "Work is Progress Tools" |
|
@khanasif786 Done, thanks |
|
@esatiyev, could you post a picture of the webtool in the description at the top? That will let people know more quickly what it looks like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for this!
|
There is a bit of MAVLink re-work in #267 too. It would be good if they could converge to keep the lib in the same place and use it in the same way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Chat.js and mavlink_msgs.js can just be removed?
I have removed the unnecessary files as suggested in commit 06aab8b . Thanks. |
and added mavftp (cherry picked from commit 90dfb75)
| <!-- script for Mavlink export --> | ||
| <script src="shared.js"></script> | ||
| <!-- simple script functions local to this page --> | ||
| <script type="module"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this script to a separate file. It would improve the performance and readability.
| eyeIconContainer.innerHTML = eyeClosedSVGPath; | ||
| } | ||
| } | ||
| // listener for toggle api key visibility button click |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // listener for toggle api key visibility button click | |
| // listener for toggle api key visibility button click |
| } | ||
|
|
||
| // attach event listener to the connect button | ||
| if (connect_button) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the if statement needed?
| document.getElementById("mavlink-disarm-button").addEventListener("click", mavlink_disarm_vehicle); | ||
|
|
||
| // add text to debug text box | ||
| function add_text_to_debug(text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also put an auto-scroll toggle button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not for this PR
| const new_thread = await openai.beta.threads.create(); | ||
| return new_thread ? new_thread.id : null; | ||
| } catch (error) { | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also log the error to console?
This pull request contains the current working version of the AI Chat WebTool being developed under Google Summer of Code 2025.
The implementation builds upon prior work by @rmackay9 and other contributors. My additions are integrated with that foundation and reflect the state of development so far.
All changes have been tested locally. Feedback is welcome.