Eduards commited on
Commit
f52ba2e
·
unverified ·
2 Parent(s): 57c0236 e799197

Merge pull request #296 from chrismahoney/fix/provider-consolelog

Browse files
app/components/chat/BaseChat.tsx CHANGED
@@ -33,7 +33,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
33
  <select
34
  value={provider?.name}
35
  onChange={(e) => {
36
- setProvider(providerList.find(p => p.name === e.target.value));
37
  const firstModel = [...modelList].find((m) => m.provider == e.target.value);
38
  setModel(firstModel ? firstModel.name : '');
39
  }}
@@ -49,7 +49,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
49
  key={provider?.name}
50
  value={model}
51
  onChange={(e) => setModel(e.target.value)}
52
- style={{maxWidth: "70%"}}
53
  className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all"
54
  >
55
  {[...modelList]
@@ -111,12 +111,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
111
  },
112
  ref,
113
  ) => {
114
- console.log(provider);
115
  const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
116
  const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
117
  const [modelList, setModelList] = useState(MODEL_LIST);
118
 
119
-
120
  useEffect(() => {
121
  // Load API keys from cookies on component mount
122
  try {
@@ -133,7 +131,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
133
  Cookies.remove('apiKeys');
134
  }
135
 
136
- initializeModelList().then(modelList => {
137
  setModelList(modelList);
138
  });
139
  }, []);
@@ -207,12 +205,13 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
207
  setProvider={setProvider}
208
  providerList={PROVIDER_LIST}
209
  />
210
- {provider &&
211
  <APIKeyManager
212
  provider={provider}
213
  apiKey={apiKeys[provider.name] || ''}
214
  setApiKey={(key) => updateApiKey(provider.name, key)}
215
- />}
 
216
  <div
217
  className={classNames(
218
  'shadow-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden transition-all',
 
33
  <select
34
  value={provider?.name}
35
  onChange={(e) => {
36
+ setProvider(providerList.find((p) => p.name === e.target.value));
37
  const firstModel = [...modelList].find((m) => m.provider == e.target.value);
38
  setModel(firstModel ? firstModel.name : '');
39
  }}
 
49
  key={provider?.name}
50
  value={model}
51
  onChange={(e) => setModel(e.target.value)}
52
+ style={{ maxWidth: '70%' }}
53
  className="flex-1 p-2 rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus transition-all"
54
  >
55
  {[...modelList]
 
111
  },
112
  ref,
113
  ) => {
 
114
  const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
115
  const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
116
  const [modelList, setModelList] = useState(MODEL_LIST);
117
 
 
118
  useEffect(() => {
119
  // Load API keys from cookies on component mount
120
  try {
 
131
  Cookies.remove('apiKeys');
132
  }
133
 
134
+ initializeModelList().then((modelList) => {
135
  setModelList(modelList);
136
  });
137
  }, []);
 
205
  setProvider={setProvider}
206
  providerList={PROVIDER_LIST}
207
  />
208
+ {provider && (
209
  <APIKeyManager
210
  provider={provider}
211
  apiKey={apiKeys[provider.name] || ''}
212
  setApiKey={(key) => updateApiKey(provider.name, key)}
213
+ />
214
+ )}
215
  <div
216
  className={classNames(
217
  'shadow-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden transition-all',
app/components/workbench/EditorPanel.tsx CHANGED
@@ -23,6 +23,7 @@ import { isMobile } from '~/utils/mobile';
23
  import { FileBreadcrumb } from './FileBreadcrumb';
24
  import { FileTree } from './FileTree';
25
  import { Terminal, type TerminalRef } from './terminal/Terminal';
 
26
 
27
  interface EditorPanelProps {
28
  files?: FileMap;
@@ -203,7 +204,7 @@ export const EditorPanel = memo(
203
  const isActive = activeTerminal === index;
204
 
205
  return (
206
- <>
207
  {index == 0 ? (
208
  <button
209
  key={index}
@@ -222,7 +223,7 @@ export const EditorPanel = memo(
222
  Bolt Terminal
223
  </button>
224
  ) : (
225
- <>
226
  <button
227
  key={index}
228
  className={classNames(
@@ -238,9 +239,9 @@ export const EditorPanel = memo(
238
  <div className="i-ph:terminal-window-duotone text-lg" />
239
  Terminal {terminalCount > 1 && index}
240
  </button>
241
- </>
242
  )}
243
- </>
244
  );
245
  })}
246
  {terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}
 
23
  import { FileBreadcrumb } from './FileBreadcrumb';
24
  import { FileTree } from './FileTree';
25
  import { Terminal, type TerminalRef } from './terminal/Terminal';
26
+ import React from 'react';
27
 
28
  interface EditorPanelProps {
29
  files?: FileMap;
 
204
  const isActive = activeTerminal === index;
205
 
206
  return (
207
+ <React.Fragment key={index}>
208
  {index == 0 ? (
209
  <button
210
  key={index}
 
223
  Bolt Terminal
224
  </button>
225
  ) : (
226
+ <React.Fragment>
227
  <button
228
  key={index}
229
  className={classNames(
 
239
  <div className="i-ph:terminal-window-duotone text-lg" />
240
  Terminal {terminalCount > 1 && index}
241
  </button>
242
+ </React.Fragment>
243
  )}
244
+ </React.Fragment>
245
  );
246
  })}
247
  {terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}