-
Notifications
You must be signed in to change notification settings - Fork 12.1k
webui : add ?m=... and ?q=... params #12148
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
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.
PR Overview
This PR implements URL query parameter handling to prefill the chat input and optionally auto-send messages based on the parameters "?m=..." and "?q=...".
- Added a utility (cleanCurrentUrl) to remove query parameters from the URL.
- Updated ChatScreen to extract query parameters and set or send the prefilled message accordingly.
Reviewed Changes
File | Description |
---|---|
examples/server/webui/src/utils/misc.ts | Added cleanCurrentUrl function to clear specified query parameters from the current URL. |
examples/server/webui/src/components/ChatScreen.tsx | Introduced query parameter extraction to prefill and optionally send messages, and updated initial state for the message input. |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
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.
PR Overview
This PR introduces functionality to prefill and optionally auto-send messages via query parameters in the web UI. Key changes include:
- Adding a helper function (cleanCurrentUrl) to remove specified query parameters from the URL.
- Implementing logic to prefill the message input with the value from the URL parameter.
- Automatically sending a message if a certain query parameter is detected.
Reviewed Changes
File | Description |
---|---|
examples/server/webui/src/utils/misc.ts | Added a utility function to clean query parameters from the URL |
examples/server/webui/src/components/ChatScreen.tsx | Prefills the message input and optionally triggers auto-send on load |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
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.
PR Overview
This pull request introduces URL query parameter handling to prefill the chat message input and trigger message sending automatically based on the presence of specific query parameters. The changes include:
- Adding a new utility function (cleanCurrentUrl) to remove specified query parameters from the URL.
- Implementing a prefill mechanism in ChatScreen.tsx that reads the URL for parameters ?m and ?q.
- Triggering automatic message sending when ?q is detected, along with input focus management.
Reviewed Changes
File | Description |
---|---|
examples/server/webui/src/utils/misc.ts | Added cleanCurrentUrl() to remove specific query parameters from the URL. |
examples/server/webui/src/components/ChatScreen.tsx | Updated to prefill the message input and conditionally trigger automatic message sending based on URL parameters. |
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
examples/server/webui/src/components/ChatScreen.tsx:206
- Using sendNewMessage inside the useEffect without including it (or wrapping it with useCallback) in the dependency array may lead to unexpected behavior if its definition changes. Consider refactoring sendNewMessage to be memoized or adding it to the dependency array.
// eslint-disable-next-line react-hooks/exhaustive-deps
The CI fails due to timeout, maybe there's an on-going problem on HF. Not related to changes in this PR, so I will merge this PR anw |
Thanks for carrying this over to the React UI implementation. |
* webui : add ?m=... and ?q=... params * also clear prefilledMessage variable * better approach * fix comment * test: bump timeout on GITHUB_ACTION
* webui : add ?m=... and ?q=... params * also clear prefilledMessage variable * better approach * fix comment * test: bump timeout on GITHUB_ACTION
Supersede #11150
Example:
http://localhost:8080/?m=Translate%20to%20French:%20
(then user need to fill the rest)http://localhost:8080/?q=What%20is%20llama
CC @tim-janik