Skip to content

Commit

Permalink
fix(capslockx): chat
Browse files Browse the repository at this point in the history
chat
  • Loading branch information
snomiao committed Jun 13, 2023
1 parent 33d467e commit 576ac79
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
1 change: 1 addition & 0 deletions DevTools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
10 changes: 5 additions & 5 deletions DevTools/Chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,14 @@ async function onClipboardReceived() {
null;
const [params, ...contents] = content
.replace(/\r\n/g, "\n")
.split("\n\n---\n\n");
.split("\n---\n\n");
const prompt = indicatorMapping[params.trim()] ?? params.trim();
const question = contents.join("\n\n---\n\n");
console.log("Got prompt: \n", prompt);
console.log("Got question: \n", question);

await completion(prompt, content);
await completion(prompt, question);
}

//
async function completion(indicator: string, content: any) {
const r = await ai.createChatCompletion(
{
Expand Down Expand Up @@ -160,5 +159,6 @@ async function completion(indicator: string, content: any) {
// console.log(respond)
// await clipboard.write([await clipboard.read(), respond].join("\n\n\n"));
await writeFile(clipOutFile, respond);
await clipboard.write([await clipboard.read(), respond].join("\n\n\n"));
await clipboard.write(respond);
console.log("✅ clipboard written");
}
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ Anki 操作增强
CapsLockX 的核心理念是:简化系统操作逻辑,提升操作效率,且不与原有习惯键位冲突。

1. [x] 按 CapsLockX + - 键显示对应帮助(目前的显示样式相当草率)
2. [ ] i18n (eh这个真得有)
2. [ ] 自动更新(虽然 git pull 一下也不是不行)
3. [ ] 初次使用上手教程(这个现在有点简陋……)
4. [ ] 插件管理器(虽然文件系统也可以搞定)
Expand Down Expand Up @@ -664,8 +665,9 @@ CapsLockX 相关答疑直接进群 [@雪星](tencent://message?uin=997596439)

| 捐赠时间 | 名称 | 渠道 | 金额 | 备注 |
| ---------- | ------ | -------- | ----------- | ------------------------ |
| 2021-06-19 | \*\*| 支付宝 | +50.00 CNY | 小小資助,支持獨立開發者 |
| 2021-06-19 | \*\*| Alipay QR | +50.00 CNY | 小小資助,支持獨立開發者 |
| 2023-05-12 | 卡拉翁 | 微信转账 | +200.00 CNY | 🫡 (敬礼) |
| ????-??-?? | [@andriasw](github.com/andriasw) | Alipay转账 | +66.66 CNY | for CapsLockX-mac, 66.66 is good (https://github.com/andriasw) |

### 鸣谢 🙏🏻 Thanks

Expand Down
26 changes: 5 additions & 21 deletions docs/README.zhcn.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,24 +258,6 @@ Anki 操作增强
| 在 Anki-学习界面 | `Alt + i` | 快速导入剪贴版的内容(按 Tab 分割) / 比如可以从 Excel 复制 |
| 在 Anki-添加卡片界面 | `Alt + s` | 按下 添加 按钮 |

<!-- 模块文件名:App-Figma.ahk-->

### Figma Enhanced

Use Alt+HJKL to navigate, switch focus, zoom in and out in figma.
使用 Alt+HJKL 在 figma 中导航,切換焦点,縮放。

## 常用功能/特性

## 说明

| 模式 | Figma Enhanced | 说明 |
| ---------------- | :------------: | ----------------------- |
| Figma in browser | `k` | ↑ 切換元素 Prev Element |
| Figma in browser | `j` | ↓ 切換元素 Next Element |
| Figma in browser | `h` | ← 切換層級 Level parent |
| Figma in browser | `l` | → 切換層級 Level child |

<!-- 模块文件名:App-OneNote2019.ahk-->

### OneNote 2016 - 2019 增强
Expand Down Expand Up @@ -680,9 +662,11 @@ CapsLockX 相关答疑直接进群 [@雪星](tencent://message?uin=997596439)

### 捐赠记录(截至 20210821) 📄 Donate Records

| 捐赠时间 | 名称 | 渠道 | 金额 | 备注 |
| -------- | ------ | ------ | ---------- | ------------------------ |
| 20210619 | \*\*| 支付宝 | +50.00 CNY | 小小資助,支持獨立開發者 |
| 捐赠时间 | 名称 | 渠道 | 金额 | 备注 |
| ---------- | ------ | -------- | ----------- | ------------------------ |
| 2021-06-19 | \*\*| Alipay QR | +50.00 CNY | 小小資助,支持獨立開發者 |
| 2023-05-12 | 卡拉翁 | 微信转账 | +200.00 CNY | 🫡 (敬礼) |
| ????-??-?? | [@andriasw](github.com/andriasw) | Alipay转账 | +66.66 CNY | 66.66 is good (https://github.com/andriasw) |

### 鸣谢 🙏🏻 Thanks

Expand Down

0 comments on commit 576ac79

Please sign in to comment.