fix: Generate A Response button does not show context size error dialog (#6029)

* fix: Generate A Response button does not show context size error dialog

* chore: remove as a child button params
This commit is contained in:
Faisal Amir 2025-08-05 08:34:06 +07:00 committed by GitHub
parent 29ad6691d8
commit 641df474fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -36,7 +36,10 @@ export default function OutOfContextPromiseModal() {
return ( return (
<Dialog open={isModalOpen} onOpenChange={handleDialogOpen}> <Dialog open={isModalOpen} onOpenChange={handleDialogOpen}>
<DialogContent> <DialogContent
showCloseButton={false}
onInteractOutside={(e) => e.preventDefault()}
>
<DialogHeader> <DialogHeader>
<DialogTitle>{t('model-errors:title')}</DialogTitle> <DialogTitle>{t('model-errors:title')}</DialogTitle>
</DialogHeader> </DialogHeader>
@ -57,7 +60,7 @@ export default function OutOfContextPromiseModal() {
{t('model-errors:truncateInput')} {t('model-errors:truncateInput')}
</Button> </Button>
<Button <Button
asChild autoFocus
onClick={() => { onClick={() => {
handleContextLength() handleContextLength()
}} }}

View File

@ -365,8 +365,7 @@ export const useChat = () => {
if ( if (
typeof errorMessage === 'string' && typeof errorMessage === 'string' &&
errorMessage.includes(OUT_OF_CONTEXT_SIZE) && errorMessage.includes(OUT_OF_CONTEXT_SIZE) &&
selectedModel && selectedModel
troubleshooting
) { ) {
const method = await showIncreaseContextSizeModal() const method = await showIncreaseContextSizeModal()
if (method === 'ctx_len') { if (method === 'ctx_len') {

View File

@ -4,8 +4,7 @@ import { UIEventHandler } from 'react'
import debounce from 'lodash.debounce' import debounce from 'lodash.debounce'
import cloneDeep from 'lodash.clonedeep' import cloneDeep from 'lodash.clonedeep'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
import { ArrowDown } from 'lucide-react' import { ArrowDown, Play } from 'lucide-react'
import { Play } from 'lucide-react'
import HeaderPage from '@/containers/HeaderPage' import HeaderPage from '@/containers/HeaderPage'
import { useThreads } from '@/hooks/useThreads' import { useThreads } from '@/hooks/useThreads'
@ -328,7 +327,7 @@ function ThreadDetail() {
> >
{showScrollToBottomBtn && ( {showScrollToBottomBtn && (
<div <div
className="bg-main-view-fg/10 px-4 border border-main-view-fg/5 flex items-center justify-center rounded-xl gap-x-2 cursor-pointer pointer-events-auto" className="bg-main-view-fg/10 px-2 border border-main-view-fg/5 flex items-center justify-center rounded-xl gap-x-2 cursor-pointer pointer-events-auto"
onClick={() => { onClick={() => {
scrollToBottom(true) scrollToBottom(true)
setIsUserScrolling(false) setIsUserScrolling(false)
@ -340,7 +339,7 @@ function ThreadDetail() {
)} )}
{showGenerateAIResponseBtn && ( {showGenerateAIResponseBtn && (
<div <div
className="bg-main-view-fg/10 px-4 border border-main-view-fg/5 flex items-center justify-center rounded-xl gap-x-2 cursor-pointer pointer-events-auto" className="mx-2 bg-main-view-fg/10 px-2 border border-main-view-fg/5 flex items-center justify-center rounded-xl gap-x-2 cursor-pointer pointer-events-auto"
onClick={generateAIResponse} onClick={generateAIResponse}
> >
<p className="text-xs">{t('common:generateAiResponse')}</p> <p className="text-xs">{t('common:generateAiResponse')}</p>