🔍 fix: Anthropic Web Search Multi-Turn Issue and Attachment Results (#12651)

* 🔍 fix: Improve WebSearch Progress Handling Based on Attachment Results

- Adjusted progress handling in the WebSearch component to treat searches as complete if attachments contain results, addressing issues with server tool calls not receiving completion signals.
- Introduced `effectiveProgress` to reflect the actual state of progress based on the presence of results, enhancing the accuracy of cancellation and completion states.
- Updated related logic to ensure proper handling of search completion and finalization states based on the new progress calculations.

* fix: only override progress when not streaming

During streaming (isSubmitting=true), use actual progress so the
searching/processing/reading states display correctly. Only override
to 1 after streaming completes to prevent the cancelled check from
hiding the component.

* chore: Update @librechat/agents and mathjs dependencies to latest versions

* chore: Upgrade mathjs dependency to version 15.2.0 across package-lock and package.json files
This commit is contained in:
Danny Avila 2026-04-13 15:44:41 -04:00 committed by GitHub
parent 5cc783b8e8
commit 60cee6eec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 18 deletions

View file

@ -92,10 +92,19 @@ export default function WebSearch({
const localize = useLocalize();
const { searchResults } = useSearchContext();
const error = typeof output === 'string' && output.toLowerCase().includes('error processing');
const cancelled = (!isSubmitting && progress < 1) || error === true;
const complete = !isLast && progress === 1;
const finalizing = isSubmitting && isLast && progress === 1;
// Server tool calls (srvtoolu_) never receive ON_RUN_STEP_COMPLETED, so progress
// stays at the default 0.1. Treat the search as complete if attachments have results.
const hasResults = useMemo(
() =>
attachments?.some((att) => att.type === Tools.web_search && att[Tools.web_search]) ?? false,
[attachments],
);
const effectiveProgress = hasResults && !isSubmitting ? 1 : progress;
const cancelled = (!isSubmitting && effectiveProgress < 1) || error === true;
const complete = !isLast && effectiveProgress === 1;
const finalizing = isSubmitting && isLast && effectiveProgress === 1;
const ownTurn = useMemo((): string => {
if (!attachments) {