LIngfengDu10 downloadsOpen Copilot Quick Ask from a floating selection button, with optional selected-text prefill.
在 Obsidian 笔记中选中文字,点击浮动的「询问 AI」按钮,即可打开 Copilot Quick Ask。支持在设置中选择是否将选中文字自动填入提问框。
项目由 DLf2001 维护。这是独立的第三方插件,与 Obsidian 和 Copilot 官方无隶属关系。
copilot:trigger-quick-ask 和输入框结构。其他版本需要实际验证。目前不支持手机、阅读模式、源码模式或 PDF 选词。本插件不包含 Copilot,不修改其文件,也不提供模型服务。
也可打开 社区插件页面,点击 Add to Obsidian,在 Obsidian 中完成安装和启用。
main.js、manifest.json、styles.css 三个附件。.obsidian/plugins/selection-ai-button/。目录结构:
你的知识库/
└─ .obsidian/plugins/selection-ai-button/
├─ main.js
├─ manifest.json
└─ styles.css
插件显示名称为 Selection AI Button,GitHub 仓库名保留 selection-ai-button-for-obsidian。内部插件 ID 仍为 selection-ai-button,已有安装可以直接更新,无需重新创建项目或迁移设置。
点击问答浮窗外部可关闭它。重新选择另一段文字,再点击「询问 AI」,会打开针对新选区的问答;开启自动填入时,提问框会填入最新选区内容。
例如选中「激光谐振腔稳定条件」,打开问答后输入「解释这个条件的物理意义,并说明公式中各符号的含义」。
进入「设置 → Selection AI Button」。
| 选项 | 关闭(默认) | 开启 |
|---|---|---|
| 自动填入选中文字 | 提问框保持空白,选中文字由 Copilot 作为上下文处理 | 将所选词句填入空白提问框,可继续编辑后发送 |
「界面语言」可选择「简体中文」或「English」,默认简体中文。切换后立即生效,并保存到本插件的本地设置;不会改变 Copilot 自身的界面语言。更新插件不会重置已有的自动填入选项。
这个选项不会调用系统复制或粘贴。若模型输入框不兼容,插件会提示手动输入。
本插件自身不发起网络请求,不读取 API Key,不索引知识库,不收集遥测。选择文字、显示按钮和自动填入都在本地完成。只有你在 Copilot 中发送请求时,Copilot 才会按其配置将上下文发送给模型服务商。
本插件免费。Copilot 或你选择的模型服务可能要求账号或按其方案收费,具体以各服务的要求为准。
源码直接使用 CommonJS,无构建步骤或运行时 npm 依赖。Obsidian 提供 obsidian 模块。
开发检查需要 Node.js 22.13 或更新版本;GitHub CI 使用 Node.js 24。
npm ci --ignore-scripts
npm test
npm run lint
自动检查覆盖语法、配置保存、选区按钮位置、不同编辑模式的显示条件、自动填入开关及禁止覆盖已有提问。完整交互仍需在 Obsidian Desktop 中验证。
提交 Issue 时请注明 Obsidian 版本、Copilot 版本、编辑模式和复现步骤,请勿上传 API Key 或私人笔记。
本项目采用 MIT 许可证,版权归 DLf2001 所有。
Select text in an Obsidian note and click the floating 询问 AI (Ask AI) button to open Copilot Quick Ask. An optional setting lets you prefill the question box with the selected text.
Maintained by DLf2001. This is an independent third-party plugin, not affiliated with Obsidian or Copilot.
copilot:trigger-quick-ask command, popup controller, and input structure. Other versions require verification.Mobile, Reading view, Source mode, and PDF selections are currently unsupported. Copilot is not bundled. This plugin does not modify Copilot files or provide a model service. The interface supports Simplified Chinese and English.
Alternatively, open the community plugin page, select Add to Obsidian, and finish installing and enabling the plugin in Obsidian.
main.js, manifest.json, and styles.css assets from the same release on GitHub Releases..obsidian/plugins/selection-ai-button/ in your vault.your-vault/
└─ .obsidian/plugins/selection-ai-button/
├─ main.js
├─ manifest.json
└─ styles.css
The display name is Selection AI Button. The GitHub repository remains selection-ai-button-for-obsidian, and the plugin ID remains selection-ai-button. Existing installations can be updated in place without migrating settings.
Click outside the question popup to dismiss it. Select different text and click Ask AI again to open a question for the new selection. With selection prefill enabled, the new text is placed in the question box.
Open Settings → Selection AI Button.
| Setting | Off (default) | On |
|---|---|---|
| 自动填入选中文字 (Prefill selected text) | Leaves the question box blank; Copilot handles the selection as context. | Inserts the selected text into an empty question box for you to edit and send. |
Interface language offers 简体中文 and English, with Simplified Chinese as the default. Changes apply immediately and are saved locally. This setting does not change Copilot's own language. Updating the plugin preserves your existing prefill preference.
Prefill does not use the system clipboard. If the input is incompatible, the plugin displays a notice so you can type your question manually.
This plugin makes no network requests, reads no API keys, does not index your vault, and collects no telemetry. Selection handling, button display, and prefill happen locally. When you send a request in Copilot, Copilot sends context to the model provider according to its configuration.
This plugin is free. Copilot or your chosen model provider may require an account or charge for services according to their own plans.
The source uses CommonJS directly, with no build step or runtime npm dependencies. Obsidian provides the obsidian module.
Development checks require Node.js 22.13 or later. GitHub CI uses Node.js 24.
npm ci --ignore-scripts
npm test
npm run lint
Automated checks cover syntax, settings persistence, selection positioning, editor modes, prefill behavior, cancellation, popup dismissal, and protecting existing questions. Full interaction still requires verification in Obsidian Desktop.
When opening an issue, include your Obsidian version, Copilot version, editor mode, and reproduction steps. Do not include API keys or private notes.
Licensed under the MIT License. Copyright DLf2001.