mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 06:52:47 +00:00
fix: Codex round 7 — surface ask-answer errors in the open popover
A failed answer submission (16k reject, network error) sets the ask status to 'error', which — unlike 'expired' — deliberately keeps the question active and retryable. But the chat card that renders the error message is suppressed while the popover is open, so a composer/popover answer failed silently. Expose an 'errored' flag from useAskAnswerMode and render a warning line (com_ui_ask_answer_error) in the popover, so the user gets feedback and retry guidance without having to collapse/dismiss. It clears automatically on retry (status flips to 'submitting').
This commit is contained in:
parent
4a97231710
commit
4e083da51e
3 changed files with 16 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { memo } from 'react';
|
||||
import { useWatch } from 'react-hook-form';
|
||||
import { Button } from '@librechat/client';
|
||||
import { Check, ChevronDown, CornerDownLeft, X } from 'lucide-react';
|
||||
import { Check, ChevronDown, CornerDownLeft, TriangleAlert, X } from 'lucide-react';
|
||||
import useAskAnswerMode from '~/hooks/Input/useAskAnswerMode';
|
||||
import { useChatFormContext } from '~/Providers';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
|
@ -37,6 +37,7 @@ function AskUserQuestionPopoverContent({
|
|||
checked,
|
||||
multiSelect,
|
||||
locked,
|
||||
errored,
|
||||
toggleChecked,
|
||||
canSubmit,
|
||||
submit,
|
||||
|
|
@ -112,6 +113,15 @@ function AskUserQuestionPopoverContent({
|
|||
</button>
|
||||
);
|
||||
})}
|
||||
{/** A failed submission keeps the question answerable (controls stay
|
||||
* enabled), but the chat card that would show the error is hidden
|
||||
* while the popover is up — so surface it here for retry guidance. */}
|
||||
{errored && (
|
||||
<div className="flex items-center gap-1.5 px-2 pt-1 text-xs text-text-warning">
|
||||
<TriangleAlert className="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
{localize('com_ui_ask_answer_error')}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center justify-between gap-2 p-2">
|
||||
<button
|
||||
type="button"
|
||||
|
|
|
|||
|
|
@ -371,6 +371,10 @@ export default function useAskAnswerMode(conversationId?: string | null) {
|
|||
submitAnswer,
|
||||
skip,
|
||||
handleComposerKeyDown,
|
||||
/** The last submission failed but the question is still answerable — the
|
||||
* popover surfaces this so a composer/popover answer doesn't fail
|
||||
* silently (the chat card's error line is hidden while the popover is up). */
|
||||
errored: status === 'error',
|
||||
/** Model-supplied "Other"-style label, folded into the inline input. */
|
||||
otherLabel,
|
||||
draftId,
|
||||
|
|
|
|||
|
|
@ -857,6 +857,7 @@
|
|||
"com_ui_artifacts_options": "Artifacts Options",
|
||||
"com_ui_artifacts_subtext": "Lets the agent render React, HTML, SVG, Markdown, and Mermaid as interactive artifacts in a side panel instead of plain code blocks.",
|
||||
"com_ui_ascending": "Asc",
|
||||
"com_ui_ask_answer_error": "Your answer couldn't be sent. Try again.",
|
||||
"com_ui_ask_type_below": "Or type your answer below",
|
||||
"com_ui_ask_type_below_only": "Type your answer below",
|
||||
"com_ui_ask_user": "Ask User",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue