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

Website translation updates #66

Merged
merged 5 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions website/src/pages/docs/references/_meta.zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"command": "命令",
"input": "动作输入",
"input": "操作输入",
"path-builder": "路径规范",
"supported-file-format": "支持的文件格式",
"supported-language": "支持的语言"
"supported-language": "支持的语言",
"supported-model-provider": "支持的模型提供商"
}
4 changes: 2 additions & 2 deletions website/src/pages/docs/references/command.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
标题:命令参考
描述:基于命令对文件进行翻译,指定文件和目标语言
title: 命令参考
description: 基于命令对文件进行翻译,指定文件和目标语言
---

import { Callout, FileTree, Steps, Tabs, Tab } from 'nextra/components'
Expand Down
58 changes: 37 additions & 21 deletions website/src/pages/docs/references/input.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -1,54 +1,70 @@
---
标题:动作输入
描述:可以传递给动作的参数
title: 操作输入
description: 可以传递给操作的参数
---

import { BookOpenIcon } from '@heroicons/react/24/outline'
import { BookOpenIcon, BookmarkSquareIcon } from '@heroicons/react/24/outline'
import { Card } from '../../../components/Card'

# 动作输入
# 操作输入

必填字段已用星号标记
必填字段标有星号

| 名称 | 描述 | 类型 |
| ------------- | ------------------------------------------------------------------ | ------------------ |
| `apikey`\* | OpenAI API密钥 | `secrets` |
| `inputFiles` | 目标文件路径 | `空格分隔的字符串` |
| `outputFiles` | 输出路径 | `空格分隔的字符串` |
| `languages` | 目标语言 | `空格分隔的字符串` |
| `model` | [OpenAI语言模型](https://platform.openai.com/docs/models/overview) | `字符串` |
| `prompt` | 对模型的指示 | `字符串` |
| `basePath` | openai api的基本路径 | `字符串` |
| 名称 | 描述 | 类型 |
| ------------------- | ---------------------------------------------------------------- | ------------------------ |
| `apikey`\* | API 密钥 | `secrets` |
| `provider` | AI 提供商 | `string` |
| `model` | 使用的语言模型 | `string` |
| `inputFiles` | 目标文件路径 | `空格分隔的字符串` |
| `outputFiles` | 输出路径 | `空格分隔的字符串` |
| `languages` | 目标语言 | `空格分隔的字符串` |
| `prompt` | 用于生成文本的输入提示 | `string` |
| `systemPrompt` | 指定模型行为的系统提示 | `string` |
| `basePath` | OpenAI API 的基本路径 | `string` |
| `top_p` | 通过核采样控制多样性(0 到 1) | `number` |
| `temperature` | 控制随机性(0 到 2) | `number` |
| `max_tokens` | 生成的最大令牌数 | `number` |
| `presence_penalty` | 根据现有存在惩罚新令牌(-2 到 2) | `number` |
| `frequency_penalty` | 根据频率惩罚新令牌(-2 到 2) | `number` |
| `seed` | 确定性采样的种子值 | `number` |

默认指定的模型是 `gpt-3.5-turbo-16k`。
默认提供商是 `openai`,模型是 `gpt-4o`。

有关更多信息,请参阅 [元数据文件](https://github.com/3ru/gpt-translate/blob/master/action.yml#L7-L54)。

## `prompt`

通过这种配置,您可以灵活地定义任何您选择的提示
通过此配置,您可以灵活定义任何提示

```yaml
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
prompt: '请将给定的文本翻译成自然的{targetLanguage}。'
prompt: '请将给定文本翻译成自然的 {targetLanguage}。'
```

您可以使用 `{}` 括号嵌入两个动态变量,使您的提示更具体:

- `targetLanguage` 表示期望的翻译语言
- `targetFileExt` 指定期望的文件扩展名(例如`.md`)。
- `targetLanguage` 表示所需的翻译语言
- `targetFileExt` 指定所需的文件扩展名(例如 `.md`)。

例如,如果您希望提示翻译成特定语言并指定输出格式,您的配置可能如下所示:

```yaml
prompt: '请将给定的文本翻译成自然的{targetLanguage},并以{targetFileExt}格式输出。'
prompt: '请将给定文本翻译成自然的 {targetLanguage} 并以 {targetFileExt} 格式输出。'
```

---

### 相关
### 相关内容

<Card
icon={<BookOpenIcon />}
title='路径规范'
href='/docs/references/path-builder'
/>

<Card
icon={<BookmarkSquareIcon />}
title='OpenAI API 参考'
href='https://platform.openai.com/docs/api-reference/chat/create'
/>
6 changes: 3 additions & 3 deletions website/src/pages/docs/references/path-builder.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
标题:路径规定
描述:如何使用我们自己的符号规定各种文件的路径
title: 路径规定
description: 如何使用我们自己的符号规定各种文件的路径
---

import { BeforeAfter } from '../../../components/BeforeAfter'
Expand Down Expand Up @@ -140,4 +140,4 @@ import { Callout, FileTree } from 'nextra/components'
}
/>

因此,你可以使用 `**` 来继承目录和 `*` 来继承文件名。
因此,你可以使用 `**` 来继承目录和 `*` 来继承文件名。
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
标题:支持的文件格式
描述:可供翻译的文件格式列表
title: 支持的文件格式
description: 可供翻译的文件格式列表
---

# 支持的文件格式
Expand Down
4 changes: 2 additions & 2 deletions website/src/pages/docs/references/supported-language.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
标题:支持的语言
描述:可用于翻译的语言列表
title: 支持的语言
description: 可用于翻译的语言列表
---

# 支持的语言
Expand Down
239 changes: 239 additions & 0 deletions website/src/pages/docs/references/supported-model-provider.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
---
title: 支持的模型提供商
description: 支持的模型提供商列表
---

import { Callout } from 'nextra-theme-docs'
import { BookOpenIcon } from '@heroicons/react/24/outline'
import { Card } from '../../../components/Card'

# 支持的模型提供商

### [OpenAI](https://openai.com/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://platform.openai.com/docs/models'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
provider: 'openai'
model: 'gpt-4o'
```

</div></details>

### [Groq](https://groq.com/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://console.groq.com/docs/models'
/>

<details>
<summary>工作流设置示例</summary>
<div>

<Callout type='info' emoji='ℹ️'>
Groq 通过 [**OpenAI API 兼容性**](https://console.groq.com/docs/openai)
提供支持。因此,`provider` 应设置为 `openai`。
</Callout>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
provider: 'openai'
model: 'llama3-8b-8192'
```

</div></details>

### [Perplexity](https://docs.perplexity.ai/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://docs.perplexity.ai/docs/model-cards'
/>

<details>
<summary>工作流设置示例</summary>
<div>

<Callout type='info' emoji='ℹ️'>
Perplexity 通过 **OpenAI API 兼容性** 提供支持。因此,`provider` 应设置为
`openai`。
</Callout>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
provider: 'openai'
model: 'llama-3-sonar-large-32k-chat'
```

</div></details>

### [Fireworks](https://fireworks.ai/)

<Card icon={<BookOpenIcon />} title='模型' href='https://fireworks.ai/models' />

<details>
<summary>工作流设置示例</summary>
<div>

<Callout type='info' emoji='ℹ️'>
Fireworks 通过 **OpenAI API 兼容性** 提供支持。因此,`provider` 应设置为
`openai`。
</Callout>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.OPENAI_API_KEY }}
provider: 'openai'
model: 'accounts/fireworks/models/firefunction-v2'
```

</div></details>

### [Azure](https://azure.microsoft.com/en-us/products/ai-services/openai-service)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.AZURE_API_KEY }}
provider: 'azure'
model: 'your-deployment-name'
```

在 Actions secrets 变量 `AZURE_RESOURCE_NAME` 中设置您的 Azure 资源名称。

</div></details>

### [Anthropic](https://www.anthropic.com/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://docs.anthropic.com/en/docs/about-claude/models'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.ANTHROPIC_API_KEY }}
provider: 'anthropic'
model: 'claude-3-5-sonnet-20240620'
```

</div></details>

### [Google 生成式 AI](https://ai.google/discover/generativeai/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://ai.google.dev/gemini-api/docs/models/gemini#model-variations'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
provider: 'google'
model: 'models/gemini-1.5-pro'
```

</div></details>

### [Mistral](https://mistral.ai/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://docs.mistral.ai/getting-started/models/'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.MISTRAL_API_KEY }}
provider: 'mistral'
model: 'open-mistral-7b'
```

</div></details>

### [Cohere](https://cohere.com/)

<Card
icon={<BookOpenIcon />}
title='模型'
href='https://docs.cohere.com/docs/models'
/>

<details>
<summary>工作流设置示例</summary>
<div>

```yaml filename="gpt-translate.yml"
- name: 运行 GPT 翻译
if: contains(github.event.comment.body, '/gpt-translate')
uses: 3ru/gpt-translate@master
with:
apikey: ${{ secrets.COHERE_API_KEY }}
provider: 'cohere'
model: 'command-r-plus'
```

</div></details>