diff --git a/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx b/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx index 9b00d812c2f..32a6af71fed 100644 --- a/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx +++ b/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx @@ -177,6 +177,7 @@ const mockContextValue: ChatContextValue = { config: makeChatConfig({ supportFeedback: true }), onFeedback: vi.fn().mockResolvedValue(undefined), onRegenerate: vi.fn(), + showRegenerate: false, onAnnotationAdded: vi.fn(), onAnnotationEdited: vi.fn(), onAnnotationRemoved: vi.fn(), @@ -263,6 +264,7 @@ describe('Operation', () => { mockContextValue.onAnnotationEdited = vi.fn() mockContextValue.onAnnotationRemoved = vi.fn() mockContextValue.readonly = false + mockContextValue.showRegenerate = false mockProviderContext.plan.usage.annotatedResponse = 0 mockProviderContext.enableBilling = false mockAddAnnotation.mockResolvedValue({ id: 'ann-new', account: { name: 'Test User' } }) @@ -286,6 +288,12 @@ describe('Operation', () => { expect(screen.queryByRole('button', { name: 'operation.regenerate' })).not.toBeInTheDocument() }) + it('should show regenerate button when explicitly enabled without a chat input', () => { + mockContextValue.showRegenerate = true + renderOperation({ ...baseProps, noChatInput: true }) + expect(screen.getByRole('button', { name: 'operation.regenerate' })).toBeInTheDocument() + }) + it('should show TTS button when text_to_speech is enabled', () => { mockContextValue.config = makeChatConfig({ text_to_speech: { enabled: true } }) renderOperation() diff --git a/web/app/components/base/chat/chat/answer/operation.tsx b/web/app/components/base/chat/chat/answer/operation.tsx index a2bed1066c1..7d6f14b5556 100644 --- a/web/app/components/base/chat/chat/answer/operation.tsx +++ b/web/app/components/base/chat/chat/answer/operation.tsx @@ -86,6 +86,7 @@ function Operation({ onAnnotationRemoved, onFeedback, onRegenerate, + showRegenerate, readonly, } = useChatContext() const [isShowReplyModal, setIsShowReplyModal] = useState(false) @@ -389,7 +390,7 @@ function Operation({