mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
codex: update create-api-key snapshots
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -30,9 +30,7 @@ impl ChatWidget {
|
||||
}
|
||||
}
|
||||
|
||||
fn start_create_api_key_command(
|
||||
app_event_tx: AppEventSender,
|
||||
) -> Result<PlainHistoryCell, String> {
|
||||
fn start_create_api_key_command(app_event_tx: AppEventSender) -> Result<PlainHistoryCell, String> {
|
||||
if read_openai_api_key_from_env().is_some() {
|
||||
return Ok(existing_shell_api_key_message());
|
||||
}
|
||||
@@ -40,11 +38,8 @@ fn start_create_api_key_command(
|
||||
let session = start_create_api_key_flow()
|
||||
.map_err(|err| format!("Failed to start API key creation: {err}"))?;
|
||||
let browser_opened = session.open_browser();
|
||||
let start_message = continue_in_browser_message(
|
||||
session.auth_url(),
|
||||
session.callback_port(),
|
||||
browser_opened,
|
||||
);
|
||||
let start_message =
|
||||
continue_in_browser_message(session.auth_url(), session.callback_port(), browser_opened);
|
||||
|
||||
let app_event_tx_for_task = app_event_tx;
|
||||
tokio::spawn(async move {
|
||||
@@ -129,11 +124,8 @@ async fn complete_command(
|
||||
}
|
||||
};
|
||||
let copy_result = clipboard_text::copy_text_to_clipboard(&provisioned.project_api_key);
|
||||
let session_env_result = apply_api_key_to_current_session(
|
||||
&provisioned.project_api_key,
|
||||
app_event_tx,
|
||||
)
|
||||
.await;
|
||||
let session_env_result =
|
||||
apply_api_key_to_current_session(&provisioned.project_api_key, app_event_tx).await;
|
||||
|
||||
success_cell(&provisioned, copy_result, session_env_result)
|
||||
}
|
||||
@@ -197,9 +189,7 @@ fn success_cell(
|
||||
let hint = Some(format!("{copy_status} {session_env_status}"));
|
||||
|
||||
history_cell::new_info_event(
|
||||
format!(
|
||||
"Created an API key for {organization} / {project}: {masked_api_key}"
|
||||
),
|
||||
format!("Created an API key for {organization} / {project}: {masked_api_key}"),
|
||||
hint,
|
||||
)
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
---
|
||||
source: tui/src/chatwidget/create_api_key.rs
|
||||
assertion_line: 260
|
||||
expression: render_cell(&cell)
|
||||
---
|
||||
• Finish API key creation via your browser.
|
||||
@@ -10,6 +11,6 @@ expression: render_cell(&cell)
|
||||
|
||||
https://auth.openai.com/oauth/authorize?client_id=abc
|
||||
|
||||
Codex will save OPENAI_API_KEY to /tmp/workspace/.env.local and hot-apply it here when allowed.
|
||||
Codex will display the new OPENAI_API_KEY here and copy it to your clipboard.
|
||||
|
||||
On a remote or headless machine, forward localhost:5000 back to this Codex host before opening the link.
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
---
|
||||
source: tui/src/chatwidget/create_api_key.rs
|
||||
assertion_line: 232
|
||||
expression: render_cell(&cell)
|
||||
---
|
||||
• Created an API key for Default Org / Default Project and saved OPENAI_API_KEY to /tmp/workspace/.env.local. Updated this session to use the newly created API key without touching auth.json.
|
||||
• Created an API key for Default Org / Default Project: sk-proj-123 Copied the full key to your clipboard. Set OPENAI_API_KEY in this Codex session for spawned commands.
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tui/src/chatwidget/create_api_key.rs
|
||||
assertion_line: 249
|
||||
expression: render_cell(&cell)
|
||||
---
|
||||
• Created an API key for org-default / proj-default: sk-proj-123 Could not copy the key to your clipboard: clipboard unavailable Could not set OPENAI_API_KEY in this Codex session: dependency env unavailable
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tui/src/chatwidget/create_api_key.rs
|
||||
expression: render_cell(&cell)
|
||||
---
|
||||
• Created an API key for org-default / proj-default and saved OPENAI_API_KEY to /tmp/workspace/.env.local. Saved OPENAI_API_KEY to .env.local, but left this session unchanged because ChatGPT login is required here.
|
||||
Reference in New Issue
Block a user