Commit
·
c4347cb
1
Parent(s):
eb76765
added collapsable chat area
Browse files- app/components/chat/BaseChat.tsx +38 -19
app/components/chat/BaseChat.tsx
CHANGED
@@ -47,7 +47,7 @@ const ModelSelector = ({ model, setModel, provider, setProvider, modelList, prov
|
|
47 |
key={provider?.name}
|
48 |
value={model}
|
49 |
onChange={(e) => setModel(e.target.value)}
|
50 |
-
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 lg:max-w-[70%]
|
51 |
>
|
52 |
{[...modelList]
|
53 |
.filter((e) => e.provider == provider?.name && e.name)
|
@@ -116,6 +116,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|
116 |
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
|
117 |
const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
|
118 |
const [modelList, setModelList] = useState(MODEL_LIST);
|
|
|
119 |
|
120 |
useEffect(() => {
|
121 |
// Load API keys from cookies on component mount
|
@@ -199,30 +200,48 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|
199 |
</ClientOnly>
|
200 |
<div
|
201 |
className={classNames(
|
202 |
-
'
|
203 |
{
|
204 |
'sticky bottom-2': chatStarted,
|
205 |
},
|
206 |
)}
|
207 |
>
|
208 |
-
<
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
<div
|
228 |
className={classNames(
|
|
|
47 |
key={provider?.name}
|
48 |
value={model}
|
49 |
onChange={(e) => setModel(e.target.value)}
|
50 |
+
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 lg:max-w-[70%]"
|
51 |
>
|
52 |
{[...modelList]
|
53 |
.filter((e) => e.provider == provider?.name && e.name)
|
|
|
116 |
const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200;
|
117 |
const [apiKeys, setApiKeys] = useState<Record<string, string>>({});
|
118 |
const [modelList, setModelList] = useState(MODEL_LIST);
|
119 |
+
const [isModelSettingsCollapsed, setIsModelSettingsCollapsed] = useState(false);
|
120 |
|
121 |
useEffect(() => {
|
122 |
// Load API keys from cookies on component mount
|
|
|
200 |
</ClientOnly>
|
201 |
<div
|
202 |
className={classNames(
|
203 |
+
'bg-bolt-elements-background-depth-2 p-3 rounded-lg border border-bolt-elements-borderColor relative w-full max-w-chat mx-auto z-prompt mb-6',
|
204 |
{
|
205 |
'sticky bottom-2': chatStarted,
|
206 |
},
|
207 |
)}
|
208 |
>
|
209 |
+
<div>
|
210 |
+
<div className="flex justify-between items-center mb-2">
|
211 |
+
<button
|
212 |
+
onClick={() => setIsModelSettingsCollapsed(!isModelSettingsCollapsed)}
|
213 |
+
className={classNames('flex items-center gap-2 p-2 rounded-lg transition-all', {
|
214 |
+
'bg-bolt-elements-item-backgroundAccent text-bolt-elements-item-contentAccent':
|
215 |
+
isModelSettingsCollapsed,
|
216 |
+
'bg-bolt-elements-item-backgroundDefault text-bolt-elements-item-contentDefault':
|
217 |
+
!isModelSettingsCollapsed,
|
218 |
+
})}
|
219 |
+
>
|
220 |
+
<div className={`i-ph:caret-${isModelSettingsCollapsed ? 'right' : 'down'} text-lg`} />
|
221 |
+
<span>Model Settings</span>
|
222 |
+
</button>
|
223 |
+
</div>
|
224 |
|
225 |
+
<div className={isModelSettingsCollapsed ? 'hidden' : ''}>
|
226 |
+
<ModelSelector
|
227 |
+
key={provider?.name + ':' + modelList.length}
|
228 |
+
model={model}
|
229 |
+
setModel={setModel}
|
230 |
+
modelList={modelList}
|
231 |
+
provider={provider}
|
232 |
+
setProvider={setProvider}
|
233 |
+
providerList={PROVIDER_LIST}
|
234 |
+
apiKeys={apiKeys}
|
235 |
+
/>
|
236 |
+
{provider && (
|
237 |
+
<APIKeyManager
|
238 |
+
provider={provider}
|
239 |
+
apiKey={apiKeys[provider.name] || ''}
|
240 |
+
setApiKey={(key) => updateApiKey(provider.name, key)}
|
241 |
+
/>
|
242 |
+
)}
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
|
246 |
<div
|
247 |
className={classNames(
|