{"id":49133526,"url":"https://github.com/gaboolic/moqi-im-windows","last_synced_at":"2026-04-21T20:08:52.229Z","repository":{"id":350484303,"uuid":"1197939186","full_name":"gaboolic/moqi-im-windows","owner":"gaboolic","description":" 墨奇输入法windows版。已接入librime（中州韵），内置白霜拼音。原生支持AI功能。托盘菜单支持主题替换、输入状态切换等功能。群：696353204","archived":false,"fork":false,"pushed_at":"2026-04-18T12:54:09.000Z","size":6665,"stargazers_count":33,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-18T14:40:45.774Z","etag":null,"topics":["input-method","input-methods"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaboolic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-01T02:08:11.000Z","updated_at":"2026-04-18T14:35:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gaboolic/moqi-im-windows","commit_stats":null,"previous_names":["gaboolic/moqi-im-windows"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gaboolic/moqi-im-windows","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaboolic%2Fmoqi-im-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaboolic%2Fmoqi-im-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaboolic%2Fmoqi-im-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaboolic%2Fmoqi-im-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaboolic","download_url":"https://codeload.github.com/gaboolic/moqi-im-windows/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaboolic%2Fmoqi-im-windows/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32108203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["input-method","input-methods"],"created_at":"2026-04-21T20:08:51.435Z","updated_at":"2026-04-21T20:08:52.219Z","avatar_url":"https://github.com/gaboolic.png","language":"C++","funding_links":[],"categories":["其他"],"sub_categories":[],"readme":"# Moqi IM for Windows\n\nWindows 端的输入法前端，负责把 `moqi-ime` 后端接入 **Microsoft Text Services Framework (TSF)**，并提供候选窗、语言栏按钮、组合串上屏等 Windows 平台能力。\n\n当前状态：已实现 **[Rime / 中州韵](https://github.com/rime/librime)** 输入法接入，**fcitx5** 输入法接入中。\n\n项目 TSF 层核心依赖：[`libIME2`](https://github.com/EasyIME/libIME2)。很大程度上参考了[PIME](https://github.com/EasyIME/PIME) 以及 [小狼毫](https://github.com/rime/weasel) 项目。\n\n核心引擎：[`moqi-ime`](https://github.com/gaboolic/moqi-ime)。\n\n默认输入法：[`白霜拼音`](https://github.com/gaboolic/rime-frost)\n\n## 快速开始\n下载安装包：[moqi-im-windows-setup.exe](https://github.com/gaboolic/moqi-im-windows/releases)\n\n## 特色功能\n- 托盘切换输入法状态：中英文 全半角 简繁\n- 外观编辑：主题皮肤切换、字体调整、主题色切换、自定义快捷键\n- 默认使用白霜拼音，支持切换方案集、切换输入方案、更新配置\n- 置顶短语、超级简拼\n- 输入设置：自动插入成对符号、分号键次选\n- 原生ai功能：支持整句优化、翻译、问答等，只有想不到没有做不到。编辑C:\\Users\\用户名\\AppData\\Roaming\\Moqi\\Rime\\ai_config.json 可以接入ai大模型以及自定义提示词、快捷键\n\n```\n{\n  \"api\": {\n    \"base_url\": \"\",\n    \"api_key\": \"\",\n    \"model\": \"\"\n  },\n  \"actions\": [\n    {\n      \"name\": \"写好评\",\n      \"hotkey\": \"Ctrl+Shift+G\",\n      \"prompt\": \"请围绕“{{candidate_1}}”生成最多 3 条适合直接发布的中文好评，每条 20 字左右。\"\n    },\n    {\n      \"name\": \"优化整句\",\n      \"hotkey\": \"Ctrl+Shift+O\",\n      \"prompt\": \"上一句是：{{previous_commit}}\\n原始输入拼音是：{{composition}}\\n前三个候选词：\\n{{candidates_top3}}\\n请严格遵循原始输入拼音来选字，只能在符合这串拼音的候选范围内优化整句，不要凭空改成不匹配拼音的字词。只输出 1 条最通顺、最自然的整句候选，不要解释。\"\n    },\n    {\n      \"name\": \"中译英\",\n      \"hotkey\": \"Ctrl+Shift+E\",\n      \"prompt\": \"请把当前中文内容翻译成自然、地道的英文。 “{{candidate_1}}” 只输出 1 条英文翻译，不要解释。\"\n    },\n    {\n      \"name\": \"问答\",\n      \"hotkey\": \"Ctrl+Shift+Q\",\n      \"prompt\": \"用户询问： “{{candidate_1}}” 只输出 1 条答案，不要解释。\"\n    }\n  ]\n}\n```\n\n## 功能演示\nai功能演示：https://github.com/gaboolic/moqi-im-windows/issues/4\n\n![菜单主题](others/imgs/caidan-zhuti.png)\n![菜单方案集](others/imgs/caidan-schemas.png)\n![菜单方案](others/imgs/caidan-schema.png)\n![输入1](others/imgs/input-zise.png)\n\n![输入2](others/imgs/input-mo.png)\n![输入3](others/imgs/input-qi.png)\n\n## 运行架构\n\n```\n┌─────────────────────────────────────────────┐\n│           Windows 应用程序                 │\n│      (记事本 / Word / 浏览器 / 其他)        │\n├─────────────────────────────────────────────┤\n│  MoqiTextService.dll                        │\n│  - TSF 接口实现                             │\n│  - 按键事件/组合串/候选窗处理               │\n│  - 通过命名管道连接 Launcher                │\n├─────────────────────────────────────────────┤\n│  MoqiLauncher.exe                            │\n│  - 读取 backends.json                       │\n│  - 管理后端进程生命周期                     │\n│  - 在命名管道与后端 stdin/stdout 之间转发消息│\n├─────────────────────────────────────────────┤\n│  moqi-ime\\server.exe                        │\n│  - Go 后端进程                              │\n│  - 加载 input_methods\\*\\ime.json            │\n│  - 返回候选、状态、上屏文本等               │\n└─────────────────────────────────────────────┘\n```\n\n当前默认部署中，`backends.json` 指向 `moqi-ime\\server.exe`；Windows 侧通过本地命名管道连到 `MoqLauncher`，`MoqLauncher` 再把请求按行写入后端的标准输入，并从标准输出读取响应。\n\n## 核心职责\n\n- **TSF 文本服务**：实现 `ITfTextInputProcessor`、`ITfKeyEventSink` 等接口\n- **Windows UI**：管理候选窗口、消息窗口、语言栏按钮和 preserved keys\n- **协议转换**：把按键与状态序列化为 JSON 请求，并应用后端返回的组合串、候选和提交文本\n- **后端接入**：通过 `MoqLauncher` 读取 `backends.json`，按语言配置 GUID 路由到对应后端\n\n## 与 `moqi-ime` 的关系\n\n本仓库不实现拼音解析、候选生成、词库管理等输入法核心逻辑，这些能力由 `moqi-ime` 提供。\n\nWindows 侧的职责主要是：\n\n- 把 TSF 生命周期和按键事件转发给后端\n- 根据后端返回结果更新候选窗、组合串和状态\n- 从已安装后端目录扫描 `input_methods/*/ime.json`，为语言配置提供元数据与配置入口\n\n因此，`moqi-im-windows` 与 `moqi-ime` 需要配套部署。\n\n## 技术栈\n\n- **语言**：C++ 、GO\n- **框架**：Microsoft TSF、Win32 API\n- **进程/IO**：命名管道、子进程 `stdin/stdout` 转发、`libuv`\n- **数据格式**：protobuf(见/proto/moqi.proto)\n- **日志**：`spdlog`\n- **构建**：CMake + Visual Studio 2022 / MSBuild\n\n## 源码布局\n\n- `MoqiTextService`：TSF 文本服务，产出 `MoqiTextService.dll`\n- `MoqLauncher`：后端启动器与消息转发器，产出 `MoqiLauncher.exe`\n- `libIME2`：IME/TSF 基础库，也是本项目 TSF 层的核心依赖，来源：[`gaboolic/libIME2`](https://github.com/gaboolic/libIME2)\n- `libuv`：Launcher 的事件循环与进程/管道依赖\n- `backends.json`：后端清单，定义后端名称、启动命令和工作目录\n- `scripts`：构建脚本\n- `installer/`：Inno Setup 安装器脚本与输出目录\n\n## 构建\n\n前置：**Visual Studio 2022**、**CMake 3.21+**、Windows SDK。\n\n在本仓库根目录执行：\n\n   `powershell -ExecutionPolicy Bypass -File .\\scripts\\_all_in_package.ps1`\n\n该脚本会生成安装器：`installer\\dist\\moqi-im-windows-setup.exe`\n\n## 参考文档\n\n- [Microsoft TSF 文档](https://docs.microsoft.com/en-us/windows/win32/tsf/text-services-framework)\n- [ITfTextInputProcessor 接口](https://docs.microsoft.com/en-us/windows/win32/api/msctf/nn-msctf-itftextinputprocessor)\n- [PIME](https://github.com/EasyIME/PIME)\n- [小狼毫](https://github.com/rime/weasel)\n\n## 友情链接\n\n白霜拼音 \u003chttps://github.com/gaboolic/rime-frost\u003e\n\n墨奇音形 \u003chttps://github.com/gaboolic/rime-shuangpin-fuzhuma\u003e\n\n墨奇五笔整句 \u003chttps://github.com/gaboolic/rime-wubi-sentence\u003e\n\n### Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=gaboolic/moqi-im-windows\u0026type=Date)](https://star-history.com/#gaboolic/moqi-im-windows\u0026Date)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaboolic%2Fmoqi-im-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaboolic%2Fmoqi-im-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaboolic%2Fmoqi-im-windows/lists"}