Skip to content

fix(export): expand group system messages and add Rust exporter#1010

Open
jingkarqi wants to merge 5 commits into
hicccc77:mainfrom
jingkarqi:main
Open

fix(export): expand group system messages and add Rust exporter#1010
jingkarqi wants to merge 5 commits into
hicccc77:mainfrom
jingkarqi:main

Conversation

@jingkarqi
Copy link
Copy Markdown

Summary

Fixes #877

This PR focuses on export correctness and performance:

  • Fixes group chat system-message export where WeChat template placeholders such as $username$ and $names$ were exported literally instead of being expanded to readable member names.
  • Adds a Rust-based streaming exporter for large text-only exports, with an engine preference setting (Auto / Rust / TypeScript).
  • Adds a TypeScript streaming export path for supported text formats and keeps the existing TypeScript exporter as the compatibility path for media/avatar/voice-transcription/full-format exports.
  • Shows the active export engine in task progress so users can tell whether a task is using Rust, TypeScript, or a Rust-to-TypeScript fallback.
  • Adds Vitest coverage for the new formatter, engine routing, streaming message reads, writers, pause/cancel handling, and large synthetic exports.

What Changed

Fix group system-message placeholders

  • Extracted shared system-message formatting into systemMessageFormatter.
  • Reused the formatter from both chat display/export paths.
  • Added support for resolving system-message templates that carry member data in <link name="..."> / <member> structures.
  • Covers invitation and QR-code join messages so exported content becomes readable, for example:
    • before: "$username$"邀请"$names$"加入了群聊
    • after: "张三"邀请"李四、王五"加入了群聊

Add Rust export engine

  • Added a native Rust exporter project under native/weflow-exporter.
  • Added scripts/build-rust-exporter.cjs to build and copy the native binary into resources/exporter/<platform>/<arch>.
  • Added the Windows x64 exporter binary resource.
  • Rust is used for text-only supported formats: JSON, TXT, HTML, ChatLab JSONL, and WeClone.

Export engine routing and fallback

  • Added a central export-engine router.
  • Auto mode chooses Rust only when the selected export is supported and text-only.
  • Media, avatar, voice, file, emoji, and voice-to-text exports remain on TypeScript for compatibility.
  • In Auto, Rust failure falls back to TypeScript; manually selecting Rust keeps failure strict.
  • Pause/cancel signals are preserved and are not treated as Rust failures.

UI and config

  • Added export engine preference to export defaults.
  • Added engine labels to export task progress.
  • Avoided silently rewriting user export options in the renderer; backend routing now decides the engine from the real user-selected options.

Verification

  • npm run typecheck
  • npm run test
  • npm run build:rust-exporter
  • npm run build produced release/win-unpacked/WeFlow.exe; local installer packaging was blocked by Windows symlink permission while electron-builder extracted winCodeSign, unrelated to app compilation.

@xunchahaha
Copy link
Copy Markdown
Collaborator

rust导出仅支持纯文字导出 42000条的会话我实测仅跟现有方案差了半秒左右 ·并且没有考虑多平台适配 chatlab的jsonl导出也破坏了格式 我觉得应该可以删了 仅保留群聊邀请消息的修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 群聊导出中的邀请记录无法正常查看

2 participants