Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions agent-shell-openai.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,28 @@ Uses `agent-shell-openai-authentication' for authentication configuration."
(error "Missing required argument: :buffer"))
(cond
((map-elt agent-shell-openai-authentication :api-key)
(agent-shell--make-acp-client :command (car agent-shell-openai-codex-command)
:command-params (cdr agent-shell-openai-codex-command)
:environment-variables (append (when-let ((api-key (agent-shell-openai-key)))
(list (format "OPENAI_API_KEY=%s" api-key)))
agent-shell-openai-codex-environment)
:context-buffer buffer))
(let ((api-key (agent-shell-openai-key)))
(unless api-key
(user-error "Please set your `agent-shell-openai-authentication'"))
(agent-shell--make-acp-client :command (car agent-shell-openai-codex-command)
:command-params (cdr agent-shell-openai-codex-command)
:environment-variables (append (list (format "OPENAI_API_KEY=%s" api-key))
agent-shell-openai-codex-environment)
:context-buffer buffer)))
((map-elt agent-shell-openai-authentication :codex-api-key)
(agent-shell--make-acp-client :command (car agent-shell-openai-codex-command)
:command-params (cdr agent-shell-openai-codex-command)
:environment-variables (append (when-let ((api-key (agent-shell-openai-key)))
(list (format "CODEX_API_KEY=%s" api-key)))
agent-shell-openai-codex-environment)
:context-buffer buffer))
(let ((codex-key (agent-shell-openai-key)))
(unless codex-key
(user-error "Please set your `agent-shell-openai-authentication'"))
(agent-shell--make-acp-client :command (car agent-shell-openai-codex-command)
:command-params (cdr agent-shell-openai-codex-command)
:environment-variables (append (list (format "CODEX_API_KEY=%s" codex-key))
agent-shell-openai-codex-environment)
:context-buffer buffer)))
((map-elt agent-shell-openai-authentication :login)
(agent-shell--make-acp-client :command (car agent-shell-openai-codex-command)
:command-params (cdr agent-shell-openai-codex-command)
:environment-variables agent-shell-openai-codex-environment
:environment-variables (append '("OPENAI_API_KEY=")
agent-shell-openai-codex-environment)
:context-buffer buffer))
(t
(error "Invalid authentication configuration"))))
Expand Down