mirror of
https://github.com/qingjian-team/qingjian.git
synced 2026-11-06 08:13:51 +00:00
feat(macos): 云联想、释义兜底与测试连接记用量
以前只有 Windows 记,mac 的统计页看不到 Token;Linux 的输入法还没接云服务,支持表里仍是待实现。
This commit is contained in:
@@ -13,7 +13,8 @@ impl Host {
|
||||
/// 「测试连接」:用当前配置发一条最小请求,结果回到偏好设置窗口底部的状态行。
|
||||
pub(super) fn start_cloud_test(&mut self) {
|
||||
let config = self.settings.config().predict.clone();
|
||||
match ConnectionTest::start(&config) {
|
||||
let usage = paths::user_data_dir().map(|dir| dir.join(API_USAGE_FILE));
|
||||
match ConnectionTest::start_with_usage(&config, usage) {
|
||||
Ok(test) => {
|
||||
self.cloud_test = Some(test);
|
||||
self.cloud_test_monitor.start();
|
||||
|
||||
@@ -70,8 +70,10 @@ impl Host {
|
||||
}
|
||||
if force || config.predict != self.applied_predict {
|
||||
if config.predict.enabled {
|
||||
// 请求与 Token 记进统计页的云服务用量
|
||||
let usage = paths::user_data_dir().map(|dir| dir.join(API_USAGE_FILE));
|
||||
// 没密钥等失败只记日志、退回不联想:输入优先于一切附加功能
|
||||
match CloudPredictor::new(&config.predict) {
|
||||
match CloudPredictor::new_with_usage(&config.predict, usage.clone()) {
|
||||
Ok(predictor) => self.engine.set_predictor(Box::new(predictor)),
|
||||
Err(error) => {
|
||||
tracing::warn!(%error, "云联想未启用");
|
||||
@@ -79,7 +81,7 @@ impl Host {
|
||||
}
|
||||
}
|
||||
// 释义兜底随云联想一起开:释义表里没有的词上屏后问云端写进个人释义表
|
||||
match CloudGlossFiller::new(&config.predict) {
|
||||
match CloudGlossFiller::new_with_usage(&config.predict, usage) {
|
||||
Ok(filler) => self.engine.set_gloss_filler(Box::new(filler)),
|
||||
Err(error) => {
|
||||
tracing::warn!(%error, "释义兜底未启用");
|
||||
|
||||
@@ -85,7 +85,8 @@ impl Feature {
|
||||
Self::TogglePunctuation => [Todo, Yes, Todo],
|
||||
// 系统的文本替换只有 macOS 有
|
||||
Self::SystemTextReplacements => [Yes, No, No],
|
||||
Self::ApiUsage => [Todo, Yes, Todo],
|
||||
// Linux 的输入法还没接云服务
|
||||
Self::ApiUsage => [Yes, Yes, Todo],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@
|
||||
- [ ] 额外翻页键:macOS、Linux
|
||||
- [ ] 高亮移动键:macOS、Linux
|
||||
- [ ] Ctrl + . 切换全半角标点:macOS、Linux
|
||||
- [ ] 云服务用量统计:macOS、Linux
|
||||
- [ ] 云服务用量统计:Linux
|
||||
|
||||
## 四、其他输入方案
|
||||
|
||||
|
||||
Reference in New Issue
Block a user