LunaTranslator/docs/cht/apiservice.md
CHLBC 2290d3c6fc
Improve CHT Tutorial (#1859)
* fix: readme_cht.md

* fix: cht qudai, alltoolbuttons.md, apiservice.md

* fix: cht qudai

* fix: cht embedtranslate.md-emugames_template.md

* fix: cht qudai

* fix: cht alltoolbuttons.md, embedtranslate.md - index.md

* fix: cht index.md - sr.md

* fix: qa1.md, sr.md, textprocess.md - yomitan.md

* fix: cht `、` to ``

* fix: cht title "&" to " & "

* fix: cht include json qudai shibie to bianshi

* fix: cht windows setting describe

* fix: cht del useless space

* fix: cht.ts

* fix: cht new

* fix: cht del useless space

* fix: cht huashu youbiao to huashu

* fix: cht small

* fix: cht `,` to ` `

* fix: dakai to kaiqi

* fix: cht small

* fix: cht readme

* fix: cht `/` to `、`

* fix: cht `/` to `、`

* fix: cht small error about ... and /

* fix: cht final check
2025-08-22 08:36:08 +08:00

2 KiB
Raw Permalink Blame History

網路服務

Web 頁面

  1. /page/mainui

    與主視窗顯示的文字內容同步

  2. /page/transhist

    與歷史文字顯示的文字內容同步

  3. /page/dictionary

    查詢單字頁面。在/page/mainui中進行點擊單字查詞時會喚出該頁面。

  4. /

    整合上述三個頁面的一個頁面。在該視窗中的/page/mainui子區域中進行點擊單字查詞時,不會開啟新的查詞視窗,而是會在目前視窗的/page/dictionary子區域中進行查詞。

  5. /page/translate

    翻譯介面

  6. /page/ocr

    OCR 介面

  7. /page/tts

    TTS 介面

API 服務

HTTP 服務

  1. /api/translate

    • 必須指定查詢參數text
    • 如果指定參數id(翻譯器的 ID則會使用該翻譯器進行翻譯否則會回傳最快的翻譯介面
    • 回傳application/json,包含翻譯器 IDid、名稱name和翻譯結果result
  2. /api/dictionary

    • 必須指定查詢參數word
    • 如果指定參數id(詞典的 ID則會回傳該詞典的查詢結果的application/json物件,包含詞典 IDid、詞典名稱name和 HTML 內容result。如果查詢失敗則會回傳一個空的物件
    • 否則會查詢所有詞典,回傳event/text-stream,每個 Event 為一個 JSON 物件,包含詞典 IDid、詞典名稱name和 HTML 內容result
  3. /api/mecab

    • 必須指定查詢參數text
    • 回傳 Mecab 對text的解析結果
  4. /api/tts

    • 必須指定查詢參數text
    • 回傳音訊的二進制資料
  5. /api/ocr

    使用 POST 方法,發送 JSON 請求,包含image欄位,內容為 Base64 編碼的圖像。

  6. /api/list/dictionary

    列出目前可用的辭書

  7. /api/list/translator

    列出目前可用的翻譯器

WebSocket 服務

  1. /api/ws/text/origin

    會持續輸出所有擷取到的原文文字

  2. /api/ws/text/trans

    會持續輸出所有翻譯結果