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

[New Extension] OpenAI Translator #5306

Merged
merged 21 commits into from Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions extensions/openai-translator/.eslintrc.json
@@ -0,0 +1,10 @@
{
"root": true,
"env": {
"es2020": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"]
}
7 changes: 7 additions & 0 deletions extensions/openai-translator/.gitignore
@@ -0,0 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# misc
.DS_Store
4 changes: 4 additions & 0 deletions extensions/openai-translator/.prettierrc
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"singleQuote": false
}
3 changes: 3 additions & 0 deletions extensions/openai-translator/CHANGELOG.md
@@ -0,0 +1,3 @@
# OpenAI Translator Changelog

## [Initial Version] - 2023-03-10
21 changes: 21 additions & 0 deletions extensions/openai-translator/LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Tiou Lims

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions extensions/openai-translator/README-zh.md
@@ -0,0 +1,89 @@
# OpenAI Translator

[Raycast](https://www.raycast.com/) 基于 ChatGPT API 的 Raycast 翻译扩展。



https://user-images.githubusercontent.com/743074/224527077-8256a26a-bbeb-482e-86fa-74fe435e59fe.mov



# Insipired By

- [yetone/openai-translator](https://github.com/yetone/openai-translator)
- [yihong0618/iWhat](https://github.com/yihong0618/iWhat)

# 参考(Cpoy)

- [yetone/openai-translator](https://github.com/yetone/openai-translator) (MIT License)
- [abielzulio/chatgpt-raycast](https://github.com/abielzulio/chatgpt-raycast) (MIT License)

# 安装

## 手动

``` shell
git clone https://github.com/douo/raycast-openai-translator.git
cd raycast-openai-translator
npm install && npm run dev
```

After the extension command show up, You can stop(`Ctrl-c`) the server safely.

## 商店

等待审核。。。

# 功能

![Intro](metadata/configuration.png)

感谢 [yetone/openai-translator](https://github.com/yetone/openai-translator):

- 翻译
- 润色
- 总结

![Commands](metadata/commands.png)
![Translate](metadata/translate.png)


- What/What is it?(文本识别) (感谢 [yihong0618/iWhat](https://github.com/yihong0618/iWhat) 的 Prompts)

![What](metadata/what-zh.png)

来自 Raycast

- 自动导入当前选择文本
- 自动导入剪切板文本
- 可绑定全局快捷键

![Actions](metadata/actions.png)


其他

- 历史记录
- 文本复制
- 流式文本显示
- 手动指定文本语言(自动检测在混合有多语言字符的情况下还不太靠谱)
- 自定义 API URL
- [ ] Proxy
- [ ] i18n
- [ ] TTS

![Stream UI](metadata/stream-text.png)
![Lang Dropdown](metadata/lang-dropdown.png)
![Empty](metadata/empty.png)

# 如何配置一键查询

- 配置扩展
1. 配置全局快捷键
2. 确保打开自动带入高亮文字和自动开始查询

![打开全局快捷键](https://user-images.githubusercontent.com/743074/224528361-6231ba8f-d8aa-45d7-9a36-cb3889452254.png)

全键盘操作的效果:

https://user-images.githubusercontent.com/743074/224528436-afca923d-b781-4754-86f5-e6b439b3e9e9.mov
84 changes: 84 additions & 0 deletions extensions/openai-translator/README.md
@@ -0,0 +1,84 @@
# OpenAI Translator

[Raycast](https://www.raycast.com/) extension for translation based on ChatGPT API.

https://user-images.githubusercontent.com/743074/224527077-8256a26a-bbeb-482e-86fa-74fe435e59fe.mov

# Insipired By

- [yetone/openai-translator](https://github.com/yetone/openai-translator)
- [yihong0618/iWhat](https://github.com/yihong0618/iWhat)

# Learn(Cpoy) a lot from

- [yetone/openai-translator](https://github.com/yetone/openai-translator) (MIT License)
- [abielzulio/chatgpt-raycast](https://github.com/abielzulio/chatgpt-raycast) (MIT License)

# Install

## Manual

``` shell
git clone https://github.com/douo/raycast-openai-translator.git
cd raycast-openai-translator
npm install && npm run dev
```

After the extension command show up, You can stop(`Ctrl-c`) the server safely.

## Store

Waitting Raycast's review : https://github.com/raycast/extensions/pull/5306

# Feature

![Intro](doc/configuration.png)

Thanks to [yetone/openai-translator](https://github.com/yetone/openai-translator):

- Translate
- Polishing
- Summarize

![Commands](doc/commands.png)
![Translate](doc/translate.png)


- What/What is it? (Thanks to [yihong0618/iWhat](https://github.com/yihong0618/iWhat) 的 Prompts)

![What](doc/what-en.png)

From Raycast:

- Automatically import the currently selected text
- Automatically import clipboard text
- Bindable global shortcuts

![Actions](doc/actions.png)

Others:

- History records
- Text copy
- Stream text display
- Manually specify text language (automatic detection is not reliable when mixing multiple languages)
- Custom API Entrypoint
- [ ] Proxy
- [ ] i18n
- [ ] TTS

![Stream UI](doc/stream-text.png)
![Lang Dropdown](doc/lang-dropdown.png)
![Empty](doc/empty.png)

# How to configure one-click query

- Configure the extension
1. Configure global shortcuts
2. Ensure that automatic import of highlighted text and automatic start of query are enabled

![Enable Global Shortcuts](https://user-images.githubusercontent.com/743074/224528361-6231ba8f-d8aa-45d7-9a36-cb3889452254.png)

The example of pure keyboard operation:

https://user-images.githubusercontent.com/743074/224528436-afca923d-b781-4754-86f5-e6b439b3e9e9.mov
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/actions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/commands.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/empty.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/mode.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/stream-text.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/translate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/what-en.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extensions/openai-translator/doc/what-zh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.