feat(cli): prompt for OpenAI API key in interactive mode#403
Open
AliaksandrNazaruk wants to merge 1 commit intothesysdev:mainfrom
Open
feat(cli): prompt for OpenAI API key in interactive mode#403AliaksandrNazaruk wants to merge 1 commit intothesysdev:mainfrom
AliaksandrNazaruk wants to merge 1 commit intothesysdev:mainfrom
Conversation
When running create-chat-app interactively, prompt the user for their OpenAI API key, create the .env file automatically, and simplify the getting-started instructions. In non-interactive mode, the behavior remains unchanged. Closes thesysdev#399
rabisg
requested changes
Mar 26, 2026
Member
rabisg
left a comment
There was a problem hiding this comment.
This works great - just a minor change for simplifying the code
|
|
||
| console.info(getStartedMessage(name, devCmd)); | ||
| if (!options.noInteractive) { | ||
| const apiKeyArgs = await resolveArgs( |
Member
There was a problem hiding this comment.
resolveOne was meant as a utility for when the value can be passed from both the cli as flags and in interactive mode. Since we don't want this in non-interactive mode or a flag for this, you can directly use inquirer here
Contributor
There was a problem hiding this comment.
+1
Also, this can be reorganized into a fn in the lib/ folder to clean up the command and keep it as a high-level orchestrator.
Contributor
There was a problem hiding this comment.
There's also a merge conflict to be resolved with the skill option.
I think it can be extended to a 3-step scenario
- Ask for OpenAI SDK BaseUrl (read a comment/issue about someone using OpenRouter, I personally used Gemini) (default value can be something like "Use OpenAI")
- (If they add a custom url) Ask for model name
- Ask for Api Key
Wdyt?
Drawbacks: prolongs the setup process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When running
create-chat-appinteractively, prompt the user for their OpenAI API key instead of printing manual instructions. If a key is provided, the CLI creates the.envfile automatically and simplifies the getting-started output. In non-interactive mode, behavior is unchanged.Changes
packages/openui-cli/src/commands/create-chat-app.ts: After installing dependencies, prompt for the OpenAI API key using the existingresolveArgshelper. If provided, write.envand show a streamlined message. If skipped (blank input) or non-interactive, show the original instructions.Closes #399