Skip to content

Commit

Permalink
fix it to use env vars if available (#1063)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelneale authored and laanak08 committed Feb 13, 2025
1 parent 7f4e0c3 commit 6f2a1a0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/goose-cli/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn setup_profile(temp_dir_path: &Path, profile_string: Option<&str>) {
"profile_items": {
"default": {
"provider": "databricks",
"model": "claude-3-5-sonnet-2",
"model": "goose",
"additional_extensions": []
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/goose-server/src/routes/providers_and_keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"databricks": {
"name": "Databricks",
"description": "Connect to LLMs via Databricks",
"models": ["claude-3-5-sonnet-2"],
"models": ["goose"],
"required_keys": ["DATABRICKS_HOST"]
},
"google": {
Expand Down
8 changes: 8 additions & 0 deletions ui/desktop/src/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ export default function ChatWindow() {
useEffect(() => {
const setupStoredProvider = async () => {
const config = window.electron.getConfig();

if (config.GOOSE_PROVIDER && config.GOOSE_MODEL) {
window.electron.logInfo(
'Initializing system with environment: GOOSE_MODEL and GOOSE_PROVIDER as priority.'
);
await initializeSystem(config.GOOSE_PROVIDER, config.GOOSE_MODEL);
return;
}
const storedProvider = getStoredProvider(config);
const storedModel = getStoredModel();
if (storedProvider) {
Expand Down
7 changes: 6 additions & 1 deletion ui/desktop/src/components/BottomMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export default function BottomMenu({ hasMessages }) {
};
}, [isModelMenuOpen]);

let envModelProvider = null;
if (window.electron.getConfig().GOOSE_MODEL && window.electron.getConfig().GOOSE_PROVIDER) {
envModelProvider = `${window.electron.getConfig().GOOSE_MODEL} - ${window.electron.getConfig().GOOSE_PROVIDER}`;
}

return (
<div className="flex justify-between items-center text-textSubtle relative bg-bgSubtle border-t border-borderSubtle text-xs pl-4 h-[40px] pb-1 align-middle">
{/* Directory Chooser - Always visible */}
Expand All @@ -72,7 +77,7 @@ export default function BottomMenu({ hasMessages }) {
className="flex items-center cursor-pointer"
onClick={() => setIsModelMenuOpen(!isModelMenuOpen)}
>
<span>{currentModel?.name || 'Select Model'}</span>
<span>{envModelProvider || currentModel?.name || 'Select Model'}</span>
{isModelMenuOpen ? (
<ChevronDown className="w-4 h-4 ml-1" />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const azure_openai_models = ['gpt-4o'];
export const default_models = {
openai: 'gpt-4o',
anthropic: 'claude-3-5-sonnet-latest',
databricks: 'claude-3-5-sonnet-2',
databricks: 'goose',
google: 'gemini-2.0-flash-exp',
groq: 'llama-3.3-70b-versatile',
openrouter: 'anthropic/claude-3.5-sonnet',
Expand Down
7 changes: 5 additions & 2 deletions ui/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const getGooseProvider = () => {
//{env-macro-start}//
//needed when goose is bundled for a specific provider
//{env-macro-end}//
return process.env.GOOSE_PROVIDER;
return [process.env.GOOSE_PROVIDER, process.env.GOOSE_MODEL];
};

const generateSecretKey = () => {
Expand All @@ -83,8 +83,11 @@ const generateSecretKey = () => {
return key;
};

let [provider, model] = getGooseProvider();

let appConfig = {
GOOSE_PROVIDER: getGooseProvider(),
GOOSE_PROVIDER: provider,
GOOSE_MODEL: model,
GOOSE_API_HOST: 'http://127.0.0.1',
GOOSE_PORT: 0,
GOOSE_WORKING_DIR: '',
Expand Down

0 comments on commit 6f2a1a0

Please sign in to comment.