FR: server: Pre-fill textarea and auto-generate based on query parameters #11150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR proposes changes to the server Web UI to add the ability to pre-fill the textarea (
id=msg-input) with a message supplied via a query parameter (?m=...) and auto-focus the textarea. Additionally, this allows pre-filling the textarea via a query parameter (?q=...) and automatically start generating a response.Example Usage:
Pre-fill the textarea and focus:
http://localhost:8080/?m=Translate%20into%20Klingon%3A%20
Pre-fill the textarea and automatically start generating a response:
http://localhost:8080/?q=What%20is%20your%20name%3F
Proposed Changes:
examples/server/webui/index.htmlto assignid=msg-inputto the "Send" button.examples/server/webui/src/main.jsto:inputMsgfrom?qor?m.?qis present.msg-inputtextarea on page load if?mis present.Use Cases:
By using browser bookmarks with query strings, several interesting model queries can be pre-populate, e.g.
?m=Summarize:,?m=Translate%20to%20French:And it allows quick testing and demonstrations:
?q=Howto%20build%20a%20Website