Skip to content

Add local/remote mode toggle for file conversion service#13

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-toggle-switch
Draft

Add local/remote mode toggle for file conversion service#13
Copilot wants to merge 2 commits intomainfrom
copilot/add-toggle-switch

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

This PR adds support for dual conversion modes in the file conversion service, allowing users to choose between using a local pandoc installation or the existing remote API service.

Changes Made

Configuration System

  • Added fileConvertMode configuration option to toggle between 'local' and 'remote' modes
  • Added pandocPath setting for specifying custom pandoc executable location
  • Default mode set to 'remote' for backward compatibility

Backend Implementation

  • New file: pandocConverter.ts - Complete pandoc integration with:
    • Pandoc availability detection
    • Format discovery from local pandoc installation
    • Local file conversion execution
  • Updated: convertController.ts - Modified to support both conversion modes:
    • Route format loading based on selected mode
    • Switch conversion execution between local and remote based on configuration
    • Enhanced error handling for pandoc-specific issues

User Interface

  • Added radio button group for mode selection (Local Mode / Remote Mode)
  • Added conditional pandoc path input field (visible only in local mode)
  • Added "Save Configuration" button to persist settings
  • Integrated seamlessly with existing conversion workflow

Internationalization

  • Added Chinese and English translations for new UI elements
  • Translation keys for modes, labels, placeholders, hints, and messages

Features

Local Mode: Uses locally installed pandoc for file conversions
Remote Mode: Uses existing remote API service (default)
Custom Pandoc Path: Optional configuration or uses system PATH
Format Detection: Automatically detects available formats in both modes
Consistent Data Structures: Both modes return identical response formats
Persistent Settings: Configuration saved and reloaded on app restart
Bilingual Support: Full Chinese and English translations

The implementation maintains backward compatibility and provides a clear migration path for users who want to use local pandoc installations.

Original prompt

添加开关


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot stopped work on behalf of ojama due to an error January 16, 2026 01:48
Copilot AI requested a review from ojama January 16, 2026 01:48
@ojama
Copy link
Collaborator

ojama commented Jan 16, 2026

@copilot 文件转换服务增加选项 “本地模式”和“远程模式”
远程模式为现在的通过远程接口服务实现的文件转换

pandoc 文档
https://pandoc.org/demos.html
https://pandoc.org/getting-started.html
本地模式的实现方式
1、增加设置选项“pandoc 路径”
2、使用pandoc 实现本地文件转换服务
3、修改路由,按照配置加载本地文件转换服务。保证数据结构和远程模式一致

Co-authored-by: ojama <1772946+ojama@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 16, 2026

@copilot 文件转换服务增加选项 “本地模式”和“远程模式”
远程模式为现在的通过远程接口服务实现的文件转换
...

I've implemented the local and remote conversion mode toggle feature as requested. Here's what I added:

Configuration Changes (commit 19690d0):

  1. Added fileConvertMode ('local' | 'remote') setting in config
  2. Added pandocPath configuration option for specifying custom pandoc location

Backend Implementation:

  1. Created pandocConverter.ts with:
    • checkPandocAvailable() - Detects pandoc availability
    • getPandocFormats() - Gets supported formats from pandoc
    • convertFileWithPandoc() - Performs local conversions
  2. Updated convertController.ts to:
    • Support both local and remote modes in format loading
    • Route conversions through local pandoc or remote service based on mode
    • Provide consistent data structures for both modes

UI Changes:

  1. Added radio button toggle for "Local Mode" / "Remote Mode" selection
  2. Added pandoc path input field (shown only in local mode)
  3. Added "Save Configuration" button to persist settings
  4. Updated Chinese and English locale files with new translation keys

The implementation ensures data structures remain consistent between both modes as requested.

Copilot AI changed the title [WIP] Add toggle switch feature Add local/remote mode toggle for file conversion service Jan 16, 2026
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.

2 participants