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

Fix/provider consolelog
This commit is contained in:
Eduard Ruzga 2024-11-16 12:11:56 +02:00 committed by GitHub
commit f52ba2ea3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View File

@ -33,7 +33,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
<select <select
value={provider?.name} value={provider?.name}
onChange={(e) => { 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); const firstModel = [...modelList].find((m) => m.provider == e.target.value);
setModel(firstModel ? firstModel.name : ''); setModel(firstModel ? firstModel.name : '');
}} }}
@ -49,7 +49,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
key={provider?.name} key={provider?.name}
value={model} value={model}
onChange={(e) => setModel(e.target.value)} 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" 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] {[...modelList]
@ -111,12 +111,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
}, },
ref, ref,
) => { ) => {
console.log(provider);
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200; const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
const [apiKeys, setApiKeys] = useState<Record<string, string>>({}); const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
const [modelList, setModelList] = useState(MODEL_LIST); const [modelList, setModelList] = useState(MODEL_LIST);
useEffect(() => { useEffect(() => {
// Load API keys from cookies on component mount // Load API keys from cookies on component mount
try { try {
@ -133,7 +131,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
Cookies.remove('apiKeys'); Cookies.remove('apiKeys');
} }
initializeModelList().then(modelList => { initializeModelList().then((modelList) => {
setModelList(modelList); setModelList(modelList);
}); });
}, []); }, []);
@ -207,12 +205,13 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
setProvider={setProvider} setProvider={setProvider}
providerList={PROVIDER_LIST} providerList={PROVIDER_LIST}
/> />
{provider && {provider && (
<APIKeyManager <APIKeyManager
provider={provider} provider={provider}
apiKey={apiKeys[provider.name] || ''} apiKey={apiKeys[provider.name] || ''}
setApiKey={(key) => updateApiKey(provider.name, key)} setApiKey={(key) => updateApiKey(provider.name, key)}
/>} />
)}
<div <div
className={classNames( 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', 'shadow-lg border border-bolt-elements-borderColor bg-bolt-elements-prompt-background backdrop-filter backdrop-blur-[8px] rounded-lg overflow-hidden transition-all',

View File

@ -23,6 +23,7 @@ import { isMobile } from '~/utils/mobile';
import { FileBreadcrumb } from './FileBreadcrumb'; import { FileBreadcrumb } from './FileBreadcrumb';
import { FileTree } from './FileTree'; import { FileTree } from './FileTree';
import { Terminal, type TerminalRef } from './terminal/Terminal'; import { Terminal, type TerminalRef } from './terminal/Terminal';
import React from 'react';
interface EditorPanelProps { interface EditorPanelProps {
files?: FileMap; files?: FileMap;
@ -203,7 +204,7 @@ export const EditorPanel = memo(
const isActive = activeTerminal === index; const isActive = activeTerminal === index;
return ( return (
<> <React.Fragment key={index}>
{index == 0 ? ( {index == 0 ? (
<button <button
key={index} key={index}
@ -222,7 +223,7 @@ export const EditorPanel = memo(
Bolt Terminal Bolt Terminal
</button> </button>
) : ( ) : (
<> <React.Fragment>
<button <button
key={index} key={index}
className={classNames( className={classNames(
@ -238,9 +239,9 @@ export const EditorPanel = memo(
<div className="i-ph:terminal-window-duotone text-lg" /> <div className="i-ph:terminal-window-duotone text-lg" />
Terminal {terminalCount > 1 && index} Terminal {terminalCount > 1 && index}
</button> </button>
</> </React.Fragment>
)} )}
</> </React.Fragment>
); );
})} })}
{terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />} {terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}