Skip to content

Commit

Permalink
fix: width inputbox based on preference and remove tooltip image upload
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur committed Dec 23, 2024
1 parent 5163e12 commit 2f52a35
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
42 changes: 18 additions & 24 deletions web/screens/Thread/ThreadCenterPanel/ChatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,24 @@ const ChatInput = () => {
)}
>
<ul>
<Tooltip
trigger={
<li
className={twMerge(
'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))]',
activeAssistant?.model.settings?.vision_model ||
isModelSupportRagAndTools
? 'cursor-pointer'
: 'cursor-not-allowed opacity-50'
)}
onClick={() => {
if (activeAssistant?.model.settings?.vision_model) {
imageInputRef.current?.click()
setShowAttacmentMenus(false)
}
}}
>
<ImageIcon size={16} />
<span className="font-medium">Image</span>
</li>
}
content="This feature only supports multimodal models."
disabled={activeAssistant?.model.settings?.vision_model}
/>
<li
className={twMerge(
'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))]',
activeAssistant?.model.settings?.vision_model &&
isModelSupportRagAndTools
? 'cursor-pointer'
: 'cursor-not-allowed opacity-50'
)}
onClick={() => {
if (activeAssistant?.model.settings?.vision_model) {
imageInputRef.current?.click()
setShowAttacmentMenus(false)
}
}}
>
<ImageIcon size={16} />
<span className="font-medium">Image</span>
</li>
<Tooltip
side="bottom"
trigger={
Expand Down
11 changes: 10 additions & 1 deletion web/screens/Thread/ThreadCenterPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import RequestDownloadModel from './RequestDownloadModel'
import { showSystemMonitorPanelAtom } from '@/helpers/atoms/App.atom'
import { experimentalFeatureEnabledAtom } from '@/helpers/atoms/AppConfig.atom'
import { activeAssistantAtom } from '@/helpers/atoms/Assistant.atom'
import { chatWidthAtom } from '@/helpers/atoms/Setting.atom'
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'

import {
Expand Down Expand Up @@ -59,6 +60,7 @@ const ThreadCenterPanel = () => {
const experimentalFeature = useAtomValue(experimentalFeatureEnabledAtom)
const activeThread = useAtomValue(activeThreadAtom)
const activeAssistant = useAtomValue(activeAssistantAtom)
const chatWidth = useAtomValue(chatWidthAtom)
const upload = uploader()
const acceptedFormat: Accept = activeAssistant?.model.settings?.vision_model
? {
Expand Down Expand Up @@ -235,7 +237,14 @@ const ThreadCenterPanel = () => {
{reloadModel && <ModelReload />}

{activeModel && isGeneratingResponse && <GenerateResponse />}
<ChatInput />
<div
className={twMerge(
'mx-auto w-full',
chatWidth === 'compact' && 'max-w-[700px]'
)}
>
<ChatInput />
</div>
</div>
</div>
</CenterPanelContainer>
Expand Down

0 comments on commit 2f52a35

Please sign in to comment.