发布

  • [OPIK-3437] llm custom pretty (#4784)

    frostbyte_neo 发布于 2026-02-04 09:48:36 +00:00

    • precommit

    • OPIK-3437 custom pretty mode

    • OPIK-3437 custom input/output from openai

    • OPIK-3437 fix ts errors

    • OPIK-3437 fix comments

    • OPIK-3437 added legacy function tools, handle audio content and transcribtion

    • OPIK-3437 audio player error state

    • OPIK-3437 attachments fixes

    • OPIK-3437 fix unit tests

    • OPIK-3437 fix unit typecheck

    • OPIK-3437 fix gaps

    • OPIK-3437 fix UX comments

    • [OPIK-3437] Fix review comments - audio state, duplicate blocks, regex, decoupling

    Address 5 unresolved review comments from PR #4784:

    1. Audio player state desync fix:

      • Fixed onPause handler to only clear global state when this player owns it
      • Prevents state desync when multiple audio players are active
      • File: src/hooks/useAudioPlayer.ts
    2. Duplicate tool message code blocks fix:

      • Added typeof check to prevent duplicate rendering of tool messages
      • Tool messages with string content now only render once
      • File: src/components/shared/SyntaxHighlighter/llmMessages/providers/openai/mapper.ts
    3. Backend attachment placeholder regex update:

      • Updated regex to support optional suffixes like -sdk
      • Now matches patterns like [output-attachment-2-9876543210-sdk.json]
      • Files: src/lib/images.ts, src/components/shared/SyntaxHighlighter/llmMessages/utils.ts
    4. Decoupled utility function:

      • Moved isBackendAttachmentPlaceholder from UI layer to lib layer
      • Removed tight coupling between lib/images.ts and UI components
      • Files: src/lib/images.ts, src/components/shared/SyntaxHighlighter/llmMessages/utils.ts
    5. Test infrastructure:

      • Added vitest mock for react-h5-audio-player
      • All 662 tests passing
      • File: .vitest/setup.ts
    • Fix linting errors - prettier formatting and React hook dependency

    • fix comments, design upates

    • fix circ deps

    • fix review comments

    • fix review comments, new ones

    • fix linter

    • remove serach from messages tab

    • remove mapping ids

    • address PR review comments: consolidate components and fix theme color

    • Replace hardcoded bg-[#F8FAFC] with bg-primary-foreground for dark theme support
    • Move isOpikS3AttachmentUrl to dedicated lib/attachments.ts module
    • Consolidate duplicate attachment components between shared/ and pages-shared/
    • Delete unused useCopyToClipboard hook
    • Update all affected import paths

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • move AttachmentPreviewDialog, PDFPreview, TextPreview to shared

    Fix dependency violation: shared/ components cannot import from pages-shared/.
    Move these components to shared/attachments/ so ImagesListWrapper can import them.

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • address PR review comments: move llmMessages to PrettyLLMMessage and refactor multimodal handling
    • Move llmMessages/ from SyntaxHighlighter/ to PrettyLLMMessage/ (not related to syntax highlighting)
    • Update imports in 7 consumer files
    • Refactor mapper.ts: extract shared buildContentBlocks() helper to eliminate duplicate multimodal handling logic
    • address PR review: remove useMemo wrapper and add function role
    • Remove unnecessary useMemo for usage property access in MessagesTab
    • Add "function" role to isCustomInputMessage detector for legacy OpenAI support

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • fix: add SVG data URI support to media detection

    Update DATA_IMAGE_REGEX to allow longer MIME subtypes (e.g. svg+xml)
    by changing [^;]{3,4} to [^;]+ pattern. Add tests for SVG extraction.

    • fix: formatting

    Co-authored-by: GitHub Actions Bot github-actions@comet.com
    Co-authored-by: Claude Opus 4.5 noreply@anthropic.com

    下载附件