fix: width inputbox based on preference and remove tooltip image upload (#4315)

This commit is contained in:
Faisal Amir 2024-12-23 13:14:49 +08:00 committed by GitHub
parent 5163e124d8
commit abb718c57f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 25 deletions

View File

@ -231,30 +231,24 @@ const ChatInput = () => {
)} )}
> >
<ul> <ul>
<Tooltip <li
trigger={ className={twMerge(
<li 'text-[hsla(var(--text-secondary)] hover:bg-secondary flex w-full items-center space-x-2 px-4 py-2 hover:bg-[hsla(var(--dropdown-menu-hover-bg))]',
className={twMerge( activeAssistant?.model.settings?.vision_model &&
'text-[hsla(var(--text-secondary)] hover:bg-secondary flex w-full items-center space-x-2 px-4 py-2 hover:bg-[hsla(var(--dropdown-menu-hover-bg))]', isModelSupportRagAndTools
activeAssistant?.model.settings?.vision_model || ? 'cursor-pointer'
isModelSupportRagAndTools : 'cursor-not-allowed opacity-50'
? 'cursor-pointer' )}
: 'cursor-not-allowed opacity-50' onClick={() => {
)} if (activeAssistant?.model.settings?.vision_model) {
onClick={() => { imageInputRef.current?.click()
if (activeAssistant?.model.settings?.vision_model) { setShowAttacmentMenus(false)
imageInputRef.current?.click() }
setShowAttacmentMenus(false) }}
} >
}} <ImageIcon size={16} />
> <span className="font-medium">Image</span>
<ImageIcon size={16} /> </li>
<span className="font-medium">Image</span>
</li>
}
content="This feature only supports multimodal models."
disabled={activeAssistant?.model.settings?.vision_model}
/>
<Tooltip <Tooltip
side="bottom" side="bottom"
trigger={ trigger={

View File

@ -30,6 +30,7 @@ import RequestDownloadModel from './RequestDownloadModel'
import { showSystemMonitorPanelAtom } from '@/helpers/atoms/App.atom' import { showSystemMonitorPanelAtom } from '@/helpers/atoms/App.atom'
import { experimentalFeatureEnabledAtom } from '@/helpers/atoms/AppConfig.atom' import { experimentalFeatureEnabledAtom } from '@/helpers/atoms/AppConfig.atom'
import { activeAssistantAtom } from '@/helpers/atoms/Assistant.atom' import { activeAssistantAtom } from '@/helpers/atoms/Assistant.atom'
import { chatWidthAtom } from '@/helpers/atoms/Setting.atom'
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom' import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'
import { import {
@ -59,6 +60,7 @@ const ThreadCenterPanel = () => {
const experimentalFeature = useAtomValue(experimentalFeatureEnabledAtom) const experimentalFeature = useAtomValue(experimentalFeatureEnabledAtom)
const activeThread = useAtomValue(activeThreadAtom) const activeThread = useAtomValue(activeThreadAtom)
const activeAssistant = useAtomValue(activeAssistantAtom) const activeAssistant = useAtomValue(activeAssistantAtom)
const chatWidth = useAtomValue(chatWidthAtom)
const upload = uploader() const upload = uploader()
const acceptedFormat: Accept = activeAssistant?.model.settings?.vision_model const acceptedFormat: Accept = activeAssistant?.model.settings?.vision_model
? { ? {
@ -235,7 +237,14 @@ const ThreadCenterPanel = () => {
{reloadModel && <ModelReload />} {reloadModel && <ModelReload />}
{activeModel && isGeneratingResponse && <GenerateResponse />} {activeModel && isGeneratingResponse && <GenerateResponse />}
<ChatInput /> <div
className={twMerge(
'mx-auto w-full',
chatWidth === 'compact' && 'max-w-[700px]'
)}
>
<ChatInput />
</div>
</div> </div>
</div> </div>
</CenterPanelContainer> </CenterPanelContainer>