Skip to content

Commit

Permalink
Merge pull request #296 from chrismahoney/fix/provider-consolelog
Browse files Browse the repository at this point in the history
Fix/provider consolelog
  • Loading branch information
wonderwhy-er authored Nov 16, 2024
2 parents 57c0236 + e799197 commit f52ba2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 6 additions & 7 deletions app/components/chat/BaseChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
<select
value={provider?.name}
onChange={(e) => {
setProvider(providerList.find(p => p.name === e.target.value));
setProvider(providerList.find((p) => p.name === e.target.value));
const firstModel = [...modelList].find((m) => m.provider == e.target.value);
setModel(firstModel ? firstModel.name : '');
}}
Expand All @@ -49,7 +49,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
key={provider?.name}
value={model}
onChange={(e) => setModel(e.target.value)}
style={{maxWidth: "70%"}}
style={{ maxWidth: '70%' }}
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"
>
{[...modelList]
Expand Down Expand Up @@ -111,12 +111,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
},
ref,
) => {
console.log(provider);
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
const [modelList, setModelList] = useState(MODEL_LIST);


useEffect(() => {
// Load API keys from cookies on component mount
try {
Expand All @@ -133,7 +131,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
Cookies.remove('apiKeys');
}

initializeModelList().then(modelList => {
initializeModelList().then((modelList) => {
setModelList(modelList);
});
}, []);
Expand Down Expand Up @@ -207,12 +205,13 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
setProvider={setProvider}
providerList={PROVIDER_LIST}
/>
{provider &&
{provider && (
<APIKeyManager
provider={provider}
apiKey={apiKeys[provider.name] || ''}
setApiKey={(key) => updateApiKey(provider.name, key)}
/>}
/>
)}
<div
className={classNames(
'shadow-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden transition-all',
Expand Down
9 changes: 5 additions & 4 deletions app/components/workbench/EditorPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { isMobile } from '~/utils/mobile';
import { FileBreadcrumb } from './FileBreadcrumb';
import { FileTree } from './FileTree';
import { Terminal, type TerminalRef } from './terminal/Terminal';
import React from 'react';

interface EditorPanelProps {
files?: FileMap;
Expand Down Expand Up @@ -203,7 +204,7 @@ export const EditorPanel = memo(
const isActive = activeTerminal === index;

return (
<>
<React.Fragment key={index}>
{index == 0 ? (
<button
key={index}
Expand All @@ -222,7 +223,7 @@ export const EditorPanel = memo(
Bolt Terminal
</button>
) : (
<>
<React.Fragment>
<button
key={index}
className={classNames(
Expand All @@ -238,9 +239,9 @@ export const EditorPanel = memo(
<div className="i-ph:terminal-window-duotone text-lg" />
Terminal {terminalCount > 1 && index}
</button>
</>
</React.Fragment>
)}
</>
</React.Fragment>
);
})}
{terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}
Expand Down

0 comments on commit f52ba2e

Please sign in to comment.