feat(llm): add default model/provider to auto configure the driver (#7)

This commit is contained in:
2025-04-03 00:11:53 +02:00
committed by GitHub
parent 9e742b439b
commit 5b9713dc2f
6 changed files with 59 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ if [ -d /root/.local/bin ]; then
echo "Copying /root/.local/bin to /home/mcuser/.local/bin..."
mkdir -p /home/mcuser/.local/bin
cp -r /root/.local/bin/* /home/mcuser/.local/bin/
chown -R $MC_USER_ID:$MC_GROUP_ID /home/mcuser/.local/bin
chown -R $MC_USER_ID:$MC_GROUP_ID /home/mcuser/.local
fi
# Start SSH server only if explicitly enabled
@@ -158,16 +158,16 @@ else
echo "Warning: update-goose-config.py script not found. Goose configuration will not be updated."
fi
# Mark initialization as complete
echo "=== MC Initialization completed at $(date) ==="
echo "INIT_COMPLETE=true" > /init.status
# Run the user command first, if set, as mcuser
if [ -n "$MC_RUN_COMMAND" ]; then
echo '--- Executing initial command: $MC_RUN_COMMAND ---';
echo "--- Executing initial command: $MC_RUN_COMMAND ---";
gosu mcuser sh -c "$MC_RUN_COMMAND"; # Run user command as mcuser
COMMAND_EXIT_CODE=$?;
echo "--- Initial command finished (exit code: $COMMAND_EXIT_CODE) ---";
fi;
# Mark initialization as complete
echo "=== MC Initialization completed at $(date) ==="
echo "INIT_COMPLETE=true" > /init.status
exec gosu mcuser "$@"

View File

@@ -30,6 +30,26 @@ def update_config():
if "extensions" not in config_data:
config_data["extensions"] = {}
# Add default developer extension
config_data["extensions"]["developer"] = {
"enabled": True,
"name": "developer",
"timeout": 300,
"type": "builtin",
}
# Update goose configuration with model and provider from environment variables
goose_model = os.environ.get("MC_MODEL")
goose_provider = os.environ.get("MC_PROVIDER")
if goose_model:
config_data["GOOSE_MODEL"] = goose_model
print(f"Set GOOSE_MODEL to {goose_model}")
if goose_provider:
config_data["GOOSE_PROVIDER"] = goose_provider
print(f"Set GOOSE_PROVIDER to {goose_provider}")
# Get MCP information from environment variables
mcp_count = int(os.environ.get("MCP_COUNT", "0"))
mcp_names_str = os.environ.get("MCP_NAMES", "[]")