goto-assistant 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goto-assistant",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Lightweight, self-hosted personal AI assistant",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@10.29.3",
@@ -78,6 +78,33 @@ function buildDefaultMcpServers(provider, apiKey, model, baseUrl) {
78
78
  return servers;
79
79
  }
80
80
 
81
+ // Shared model-loading step: sets state, fetches models, shows choices or error.
82
+ function doLoadModels() {
83
+ setupChatState.current = 'loading_models';
84
+ addMessage('assistant', 'Loading available models...');
85
+ setInputMode('disabled');
86
+ loadModelsForChat(setupChatState.provider, setupChatState.apiKey, setupChatState.baseUrl)
87
+ .then(function (models) {
88
+ var select = document.getElementById('model');
89
+ select.innerHTML = models.map(function (m) {
90
+ return '<option value="' + escapeHtml(m.id) + '">' + escapeHtml(m.name) + '</option>';
91
+ }).join('');
92
+ setupChatState.current = 'model';
93
+ addMessage('assistant', 'Select a model:');
94
+ showChoices(models.map(function (m) {
95
+ return { label: m.name, value: m.id };
96
+ }), function (modelId) {
97
+ handleModelSelect(modelId);
98
+ });
99
+ })
100
+ .catch(function (err) {
101
+ addMessage('assistant', 'Failed to load models: ' + err.message + '\n\nPlease check your API key and try again.');
102
+ setupChatState.current = 'api_key';
103
+ addMessage('assistant', 'Please enter your API key:');
104
+ setInputMode('password');
105
+ });
106
+ }
107
+
81
108
  async function loadModelsForChat(provider, apiKey, baseUrl) {
82
109
  var res = await fetch('/api/models', {
83
110
  method: 'POST',
@@ -204,10 +231,16 @@ function handleInput(text) {
204
231
  // Update form and sync cron config
205
232
  document.getElementById('apiKey').value = text;
206
233
  syncCronFromChat();
207
- // Advance to base URL
208
- setupChatState.current = 'base_url';
209
- addMessage('assistant', 'Do you need a custom base URL? (For LiteLLM proxy)\n\nPress Enter to skip for direct API access.');
210
- setInputMode('optional');
234
+ if (setupChatState.provider === 'claude') {
235
+ // Claude Agent SDK doesn't support proxies — skip base URL
236
+ setupChatState.baseUrl = '';
237
+ doLoadModels();
238
+ } else {
239
+ // Advance to base URL for OpenAI
240
+ setupChatState.current = 'base_url';
241
+ addMessage('assistant', 'Do you need a custom base URL? (For LiteLLM proxy)\n\nPress Enter to skip for direct API access.');
242
+ setInputMode('optional');
243
+ }
211
244
  return;
212
245
  }
213
246
 
@@ -221,32 +254,7 @@ function handleInput(text) {
221
254
  // Update form and sync cron config
222
255
  document.getElementById('baseUrl').value = text || '';
223
256
  syncCronFromChat();
224
- // Load models
225
- setupChatState.current = 'loading_models';
226
- addMessage('assistant', 'Loading available models...');
227
- setInputMode('disabled');
228
- loadModelsForChat(setupChatState.provider, setupChatState.apiKey, setupChatState.baseUrl)
229
- .then(function (models) {
230
- // Update the form model dropdown
231
- var select = document.getElementById('model');
232
- select.innerHTML = models.map(function (m) {
233
- return '<option value="' + escapeHtml(m.id) + '">' + escapeHtml(m.name) + '</option>';
234
- }).join('');
235
- // Show model choices in chat
236
- setupChatState.current = 'model';
237
- addMessage('assistant', 'Select a model:');
238
- showChoices(models.map(function (m) {
239
- return { label: m.name, value: m.id };
240
- }), function (modelId) {
241
- handleModelSelect(modelId);
242
- });
243
- })
244
- .catch(function (err) {
245
- addMessage('assistant', 'Failed to load models: ' + err.message + '\n\nPlease check your API key and try again.');
246
- setupChatState.current = 'api_key';
247
- addMessage('assistant', 'Please enter your API key:');
248
- setInputMode('password');
249
- });
257
+ doLoadModels();
250
258
  return;
251
259
  }
252
260
  }
package/public/setup.html CHANGED
@@ -36,8 +36,10 @@
36
36
  <label for="apiKey">API Key</label>
37
37
  <input type="password" id="apiKey" placeholder="sk-ant-... or sk-...">
38
38
 
39
- <label for="baseUrl">Base URL <small>(optional — for LiteLLM proxy)</small></label>
40
- <input type="text" id="baseUrl" placeholder="Leave empty for direct API">
39
+ <div id="baseUrlRow">
40
+ <label for="baseUrl">Base URL <small>(optional for LiteLLM proxy)</small></label>
41
+ <input type="text" id="baseUrl" placeholder="Leave empty for direct API">
42
+ </div>
41
43
 
42
44
  <label for="model">Model</label>
43
45
  <div role="group">
@@ -128,6 +130,7 @@
128
130
  // Sync cron when provider, API key, base URL, or model changes
129
131
  document.querySelectorAll('input[name="provider"]').forEach(radio => {
130
132
  radio.addEventListener('change', () => {
133
+ toggleBaseUrl(getProvider());
131
134
  handleProviderSwitch(isEditing, window._savedConfig);
132
135
  doSyncCronConfig();
133
136
  });
@@ -348,6 +351,7 @@
348
351
  // Pre-fill form from existing config, then initialize chat panel
349
352
  (async () => {
350
353
  await window.refreshForm();
354
+ toggleBaseUrl(getProvider());
351
355
  initSetupChat({ isEditing, config: window._savedConfig || null });
352
356
  })();
353
357
 
package/public/setup.js CHANGED
@@ -100,13 +100,27 @@ function syncCronConfig(servers, isEditing, buildCronConfigFn, savedConfig) {
100
100
  return servers;
101
101
  }
102
102
 
103
+ // Toggle base URL field visibility. Claude Agent SDK doesn't work with proxies.
104
+ function toggleBaseUrl(provider) {
105
+ var row = document.getElementById('baseUrlRow');
106
+ if (!row) return;
107
+ if (provider === 'claude') {
108
+ row.style.display = 'none';
109
+ document.getElementById('baseUrl').value = '';
110
+ } else {
111
+ row.style.display = '';
112
+ }
113
+ }
114
+
103
115
  // Handle provider switch: pre-fill baseUrl and model from saved config.
104
116
  function handleProviderSwitch(isEditing, savedConfig) {
105
117
  if (!isEditing || !savedConfig) return;
106
118
 
107
119
  var p = getProvider();
108
120
  var pc = savedConfig[p] || {};
109
- document.getElementById('baseUrl').value = pc.baseUrl || '';
121
+ if (p !== 'claude') {
122
+ document.getElementById('baseUrl').value = pc.baseUrl || '';
123
+ }
110
124
  var select = document.getElementById('model');
111
125
  if (pc.model) {
112
126
  select.innerHTML = '<option value="' + escapeHtml(pc.model) + '">' + escapeHtml(pc.model) + '</option>';
@@ -116,5 +130,5 @@ function handleProviderSwitch(isEditing, savedConfig) {
116
130
  }
117
131
 
118
132
  if (typeof module !== 'undefined' && module.exports) {
119
- module.exports = { defaultServers: defaultServers, getProvider: getProvider, renderServers: renderServers, readServers: readServers, syncCronConfig: syncCronConfig, handleProviderSwitch: handleProviderSwitch };
133
+ module.exports = { defaultServers: defaultServers, getProvider: getProvider, renderServers: renderServers, readServers: readServers, syncCronConfig: syncCronConfig, handleProviderSwitch: handleProviderSwitch, toggleBaseUrl: toggleBaseUrl };
120
134
  }