Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 功能建议:Easydict 支持本地 HTTP 接口请求 #580

Closed
4 of 5 tasks
tisfeng opened this issue Jun 5, 2024 · 12 comments
Closed
4 of 5 tasks

🚀 功能建议:Easydict 支持本地 HTTP 接口请求 #580

tisfeng opened this issue Jun 5, 2024 · 12 comments
Assignees
Labels
enhancement New feature or request fixed in next release The issue will be closed once next release is available

Comments

@tisfeng
Copy link
Owner

tisfeng commented Jun 5, 2024

请先确认以下事项

  • 已仔细阅读了 README
  • issues 页面搜索过(包括已关闭的 issue),未发现类似功能建议
  • Easydict 已升级到 最新版本
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

功能描述

让 Easydict 支持本地 HTTP 接口请求,方便外部程序调用,实现翻译查询,划词,OCR,以及将 Easydict 查询结果以接口形式返回等功能。

使用场景

例如, Alfred Workflow 使用 HTTP 接口调用 Easydict #78 (comment)

实现方案(可选)

Swift HTTP 服务器使用 vapor

是否愿意提交 PR 实现该功能

  • 我愿意提交 PR
@marsjane
Copy link

marsjane commented Jun 7, 2024

支持 也非常需要这个功能 另外想问一下现在有什么通过执行一个命令的方式去调出这个划词翻译/输入翻译/截图翻译窗口的吗?类似的bob里面提供Apple script的方式, pot里面提供curl 一个本地端口的方式

@tisfeng
Copy link
Owner Author

tisfeng commented Jun 7, 2024

支持 也非常需要这个功能 另外想问一下现在有什么通过执行一个命令的方式去调出这个划词翻译/输入翻译/截图翻译窗口的吗?类似的bob里面提供Apple script的方式, pot里面提供curl 一个本地端口的方式

Easydict 支持 URL Scheme 调用。

@marsjane
Copy link

marsjane commented Jun 7, 2024

oh可不可以是一个命令直接达到按下快捷键的功能?比如我执行一个shell命令 它直接跟快捷键一样直接获取我选中的文字进行翻译? 以及另一个命令启动截图翻译等等..

@tisfeng
Copy link
Owner Author

tisfeng commented Jun 7, 2024

目前 URL Scheme 只支持调用 Easydict 查询文本:easydict://query?text=good 。

如果你想 shell 调用,你先为 Easydict 设置好快捷键,比如划词翻译 Opt + D,然后脚本使用模拟这个快捷键就行。

@WillSuo-Github
Copy link

HI, 之前我说可以帮忙搞这个的, 但是我最近有好多事情, 造成最近应该就没有时间搞这个事情了, 非常抱歉哦.

@tisfeng
Copy link
Owner Author

tisfeng commented Jun 12, 2024

Sad 😔 那暂时先放这儿。

如果有小伙伴对这个有兴趣,可以留言接手一下。

@tisfeng tisfeng self-assigned this Jul 16, 2024
@tisfeng
Copy link
Owner Author

tisfeng commented Jul 16, 2024

我来用 vapor 尝试一下。

@tisfeng tisfeng added the fixed in next release The issue will be closed once next release is available label Aug 11, 2024
@tisfeng
Copy link
Owner Author

tisfeng commented Aug 12, 2024

2.8.0 版本目前已支持 translate 和 ocr 两个接口。

@TopChina
Copy link

2.8.0 版本目前已支持 translate 和 ocr 两个接口。
curl -X POST http://localhost:8080/translate \ -H "Content-Type: application/json" \ -d '{"serviceType": "", "text": "Hello, world!", "sourceLanguage": "en", "targetLanguage": "zh"}'

是这样用吗? serviceType写什么?没找到使用说明

@tisfeng
Copy link
Owner Author

tisfeng commented Oct 20, 2024

还没写文档,,服务类型在这里

NSString *const EZServiceTypeGoogle = @"Google";

NSString *const EZServiceTypeGoogle = @"Google";
NSString *const EZServiceTypeBaidu = @"Baidu";
NSString *const EZServiceTypeYoudao = @"Youdao";
NSString *const EZServiceTypeApple = @"Apple";
NSString *const EZServiceTypeDeepL = @"DeepL";
NSString *const EZServiceTypeVolcano = @"Volcano";
NSString *const EZServiceTypeOpenAI = @"OpenAI";
NSString *const EZServiceTypeCustomOpenAI = @"CustomOpenAI";
NSString *const EZServiceTypeBuiltInAI = @"BuiltInAI";
NSString *const EZServiceTypeBing = @"Bing";
NSString *const EZServiceTypeNiuTrans = @"NiuTrans";
NSString *const EZServiceTypeCaiyun = @"Caiyun";
NSString *const EZServiceTypeTencent = @"Tencent";
NSString *const EZServiceTypeAlibaba = @"Alibaba";
NSString *const EZServiceTypeGemini = @"Gemini";
NSString *const EZServiceTypeOllama = @"Ollama";
NSString *const EZServiceTypePolishing = @"Polishing";
NSString *const EZServiceTypeSummary = @"Summary";

NSString *const EZServiceTypeAppleDictionary = @"AppleDictionary";

@TopChina
Copy link

感谢,可以用了
image

@tisfeng
Copy link
Owner Author

tisfeng commented Nov 3, 2024

2.10.0 新版本已实现该功能。

@tisfeng tisfeng closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in next release The issue will be closed once next release is available
Projects
None yet
Development

No branches or pull requests

4 participants