fix: update custom api
This commit is contained in:
@@ -1,5 +1,41 @@
|
|||||||
# 自定义接口示例
|
# 自定义接口示例
|
||||||
|
|
||||||
|
## 默认接口规范
|
||||||
|
|
||||||
|
如果接口的请求数据和返回数据符合以下规范,
|
||||||
|
则无需填写 `Request Hook` 或 `Response Hook`。
|
||||||
|
|
||||||
|
Request body
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"texts": ["hello"], // 需要翻译的文本列表
|
||||||
|
"from":"auto", // 原文语言
|
||||||
|
"to": "zh-CN" // 目标语言
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Response
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"text": "你好", // 译文
|
||||||
|
"src": "zh-CN" // 原文语言
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// v2.0.4版后亦支持以下返回格式
|
||||||
|
{
|
||||||
|
"translations": [ // 译文列表
|
||||||
|
{
|
||||||
|
"text": "你好", // 译文
|
||||||
|
"src": "zh-CN" // 原文语言
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 谷歌翻译接口
|
## 谷歌翻译接口
|
||||||
|
|
||||||
> 此接口不支持聚合
|
> 此接口不支持聚合
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ export const parseTransRes = async (
|
|||||||
}
|
}
|
||||||
return parseAIRes(modelMsg?.content);
|
return parseAIRes(modelMsg?.content);
|
||||||
case OPT_TRANS_CUSTOMIZE:
|
case OPT_TRANS_CUSTOMIZE:
|
||||||
return res?.map((item) => [item.text, item.src]);
|
return (res?.translations ?? res)?.map((item) => [item.text, item.src]);
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user