Move API credentials to .env and set gpt-5.6-luna model

- Load OPENAI_API_KEY and OPENAI_BASE_URL from gitignored .env (repo-root, CWD-independent)
- Fix command explanation to use the configured model instead of hardcoded gpt-4o-mini
- Update default model and fallbacks to gpt-5.6-luna
- Document .env-based configuration in READMEs
This commit is contained in:
2026-09-09 23:07:05 +02:00
parent 9464ed9501
commit e31e58c9c4
7 changed files with 77 additions and 19 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ def handle_command_execution(client, config, command, explain=False):
use_rich = ui_config.get("rich_formatting", True)
# Generate explanation
explanation = get_command_explanation(client, command, structured=structured)
explanation = get_command_explanation(client, command, structured=structured, model=config.get("model"))
if use_rich:
print() # Add a blank line before the explanation
+4 -3
View File
@@ -25,7 +25,7 @@ def handle_streaming_output_interactive(token):
# Print the token without a newline and flush immediately
print(token, end='', flush=True)
def get_command_explanation(client, command, structured=False):
def get_command_explanation(client, command, structured=False, model=None):
"""
Get an explanation for a command.
@@ -33,6 +33,7 @@ def get_command_explanation(client, command, structured=False):
client: The OpenAI client.
command (str): The command to explain.
structured (bool): Whether to use structured explanation format.
model (str): The model to use for explanation.
Returns:
str: The explanation of the command.
@@ -61,7 +62,7 @@ def get_command_explanation(client, command, structured=False):
"""
response = client.chat.completions.create(
model="gpt-4o-mini",
model=model or "gpt-5.6-luna",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": command}
@@ -284,7 +285,7 @@ def interactive_mode(client, config):
use_rich = ui_config.get("rich_formatting", True)
# Generate explanation
explanation = get_command_explanation(client, command, structured=structured)
explanation = get_command_explanation(client, command, structured=structured, model=config.get("model"))
if use_rich:
print() # Add a blank line before the explanation