Skip to content

Commit 499ac79

Browse files
committed
chore: regen translate stream
1 parent 02457d3 commit 499ac79

19 files changed

+1771
-17
lines changed

internal/.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ docs/models/PostTextMd5Request.md
269269
docs/models/PostTextMd5Verify200Response.md
270270
docs/models/PostTextMd5Verify400Response.md
271271
docs/models/PostTextMd5VerifyRequest.md
272+
docs/models/PostTranslateStream400Response.md
273+
docs/models/PostTranslateStream500Response.md
274+
docs/models/PostTranslateStreamRequest.md
272275
docs/models/PostTranslateText200Response.md
273276
docs/models/PostTranslateText400Response.md
274277
docs/models/PostTranslateText500Response.md
@@ -279,6 +282,9 @@ docs/models/SingleEndpoint.md
279282
docs/scripts/git_push.ps1
280283
docs/scripts/git_push.sh
281284
src/uapi-sdk-csharp.Test/Api/DependencyInjectionTests.cs
285+
src/uapi-sdk-csharp.Test/Model/PostTranslateStream400ResponseTests.cs
286+
src/uapi-sdk-csharp.Test/Model/PostTranslateStream500ResponseTests.cs
287+
src/uapi-sdk-csharp.Test/Model/PostTranslateStreamRequestTests.cs
282288
src/uapi-sdk-csharp.Test/README.md
283289
src/uapi-sdk-csharp.Test/uapi-sdk-csharp.Test.csproj
284290
src/uapi-sdk-csharp/Api/ClipzyApi.cs
@@ -570,6 +576,9 @@ src/uapi-sdk-csharp/Model/PostTextMd5Request.cs
570576
src/uapi-sdk-csharp/Model/PostTextMd5Verify200Response.cs
571577
src/uapi-sdk-csharp/Model/PostTextMd5Verify400Response.cs
572578
src/uapi-sdk-csharp/Model/PostTextMd5VerifyRequest.cs
579+
src/uapi-sdk-csharp/Model/PostTranslateStream400Response.cs
580+
src/uapi-sdk-csharp/Model/PostTranslateStream500Response.cs
581+
src/uapi-sdk-csharp/Model/PostTranslateStreamRequest.cs
573582
src/uapi-sdk-csharp/Model/PostTranslateText200Response.cs
574583
src/uapi-sdk-csharp/Model/PostTranslateText400Response.cs
575584
src/uapi-sdk-csharp/Model/PostTranslateText500Response.cs

internal/api/openapi.yaml

Lines changed: 152 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,6 +4810,96 @@ paths:
48104810
- 语言检测
48114811
- 内容分析
48124812
- 文本工具
4813+
/translate/stream:
4814+
post:
4815+
description: |-
4816+
想让翻译结果像打字机一样逐字显示出来?这个流式翻译接口能实现这种效果。
4817+
4818+
## 功能概述
4819+
不同于传统翻译API一次性返回完整结果,这个接口会实时地、一个字一个字地把翻译内容推给你(就像ChatGPT回复消息那样),非常适合用在聊天应用、直播字幕等需要即时反馈的场景。
4820+
4821+
## 它能做什么
4822+
- **中英互译**:支持中文和英文之间的双向翻译
4823+
- **自动识别**:不确定源语言?设置为 `auto` 让我们自动检测
4824+
- **逐字返回**:翻译结果会像打字机一样逐字流式返回,用户体验更流畅
4825+
- **音频朗读**:部分翻译结果会附带音频链接,方便朗读
4826+
4827+
## 支持的语言
4828+
目前专注于中英互译,支持以下选项:
4829+
- `中文`(简体/繁体)
4830+
- `英文`
4831+
- `auto`(自动检测)
4832+
operationId: post-translate-stream
4833+
requestBody:
4834+
content:
4835+
application/json:
4836+
schema:
4837+
$ref: "#/components/schemas/post_translate_stream_request"
4838+
description: 包含翻译参数的JSON对象
4839+
required: true
4840+
responses:
4841+
"200":
4842+
content:
4843+
text/event-stream:
4844+
schema:
4845+
example: |
4846+
event: start
4847+
data: ok
4848+
4849+
event: message
4850+
data: {"content":"Hello"}
4851+
4852+
event: audio
4853+
data: {"speak_url":"https://fanyi.so.com/audio?from=zh&to=en&voice=2&cate=speakUrl&key=7eca689f0d3389d9dea66ae112e5cfd7&query=你好","tSpeak_url":"/audio?from=zh&to=en&voice=2&cate=tSpeakUrl&key=8b1a9953c4611296a827abf8c47804d7&query=Hello","美":"/audio?from=zh&to=en&voice=6&cate=us-speech&key=7eca689f0d3389d9dea66ae112e5cfd7&query=你好","英":"/audio?from=zh&to=en&voice=5&cate=uk-speech&key=7eca689f0d3389d9dea66ae112e5cfd7&query=你好"}
4854+
4855+
event: end
4856+
data: ok
4857+
type: string
4858+
description: SSE流式响应。Content-Type为text/event-stream
4859+
"400":
4860+
content:
4861+
application/json:
4862+
schema:
4863+
$ref: "#/components/schemas/post_translate_stream_400_response"
4864+
description: 请求参数错误
4865+
"500":
4866+
content:
4867+
application/json:
4868+
schema:
4869+
$ref: "#/components/schemas/post_translate_stream_500_response"
4870+
description: 翻译服务错误
4871+
summary: 流式翻译(中英互译)
4872+
tags:
4873+
- Translate
4874+
x-search-words:
4875+
- 流式翻译
4876+
- SSE翻译
4877+
- 实时翻译
4878+
- 中译英
4879+
- 英译中
4880+
- 打字机效果
4881+
- 流式响应
4882+
- Server-Sent Events
4883+
- stream translate
4884+
- 实时
4885+
- 逐字翻译
4886+
x-seo-optimized-text: 免费流式翻译API接口,支持中文和英文之间的实时流式翻译。采用Server-Sent Events(SSE)技术,提供打字机效果的翻译体验。适用于实时翻译应用、聊天翻译、直播字幕、即时通讯翻译等场景。
4887+
x-seo-keywords:
4888+
- 流式翻译API
4889+
- SSE翻译接口
4890+
- 实时翻译API
4891+
- 中英互译
4892+
- 打字机翻译
4893+
- Server-Sent Events
4894+
- 流式响应翻译
4895+
- 实时翻译服务
4896+
x-seo-title: 免费流式翻译API接口 - SSE实时中英互译服务
4897+
x-seo-usage-scenarios: 适用于实时聊天翻译、直播字幕翻译、即时通讯应用、AI对话翻译、语音识别翻译、在线教育、跨境沟通等场景
4898+
x-seo-related-apis:
4899+
- 多语言文本翻译
4900+
- AI智能翻译
4901+
- 文本处理
4902+
- 实时通信
48134903
/ai/translate:
48144904
post:
48154905
description: |-
@@ -5003,6 +5093,7 @@ paths:
50035093
- 文学翻译
50045094
- 学术翻译
50055095
- 快速翻译
5096+
- 快速翻译
50065097
/ai/translate/languages:
50075098
get:
50085099
description: 获取AI智能翻译服务支持的完整语言列表、翻译风格选项、上下文场景选项以及性能指标信息。这个接口对于需要在前端动态展示翻译配置选项的应用非常有用,它会返回当前AI翻译服务所支持的所有语言代码、原生名称、翻译风格说明、上下文场景描述,以及服务的性能特征和限制信息。通过此接口,开发者可以构建用户友好的翻译界面,让用户选择合适的翻译参数。
@@ -5018,16 +5109,6 @@ paths:
50185109
summary: 获取AI翻译支持的语言和配置
50195110
tags:
50205111
- Translate
5021-
x-search-words:
5022-
- 支持语言
5023-
- 翻译配置
5024-
- 语言列表
5025-
- 翻译风格
5026-
- 上下文选项
5027-
- supported languages
5028-
- translation config
5029-
- language list
5030-
- AI翻译配置
50315112
/webparse/extractimages:
50325113
get:
50335114
description: |-
@@ -5943,6 +6024,19 @@ components:
59436024
example: 5
59446025
type: integer
59456026
type: object
6027+
post_translate_stream_500_response:
6028+
example:
6029+
code: SERVICE_ERROR
6030+
error: Translation service unavailable
6031+
properties:
6032+
error:
6033+
description: 错误描述
6034+
example: Translation service unavailable
6035+
type: string
6036+
code:
6037+
example: SERVICE_ERROR
6038+
type: string
6039+
type: object
59466040
get_misc_hotboard_200_response_list_inner:
59476041
example:
59486042
hot_value: "1234567"
@@ -6804,6 +6898,24 @@ components:
68046898
example: aK3fP7bQ9zRjT1vN
68056899
type: string
68066900
type: object
6901+
post_translate_stream_400_response:
6902+
example:
6903+
code: MISSING_QUERY
6904+
error: Missing required parameter
6905+
properties:
6906+
error:
6907+
description: 错误描述
6908+
example: Missing required parameter
6909+
type: string
6910+
code:
6911+
description: 错误码
6912+
enum:
6913+
- INVALID_REQUEST
6914+
- MISSING_QUERY
6915+
- MISSING_TARGET_LANG
6916+
example: MISSING_QUERY
6917+
type: string
6918+
type: object
68076919
get_social_qq_groupinfo_404_response:
68086920
example:
68096921
code: NOT_FOUND
@@ -8797,6 +8909,36 @@ components:
87978909
example: 2023-10-27 12:00:00
87988910
type: string
87998911
type: object
8912+
post_translate_stream_request:
8913+
properties:
8914+
query:
8915+
description: 待翻译的文本内容
8916+
example: "Hello, how are you?"
8917+
type: string
8918+
to_lang:
8919+
description: 目标语言,支持:中文、英文
8920+
enum:
8921+
- 中文
8922+
- 英文
8923+
example: 中文
8924+
type: string
8925+
from_lang:
8926+
default: auto
8927+
description: 源语言,支持:中文、英文、auto(自动检测)。默认为auto
8928+
enum:
8929+
- 中文
8930+
- 英文
8931+
- auto
8932+
example: 英文
8933+
type: string
8934+
tone:
8935+
description: 语气参数,可选
8936+
example: ""
8937+
type: string
8938+
required:
8939+
- query
8940+
- to_lang
8941+
type: object
88008942
get_misc_weather_200_response:
88018943
example:
88028944
province: 北京

internal/docs/apis/TranslateApi.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All URIs are relative to *https://uapis.cn/api/v1*
66
|--------|--------------|-------------|
77
| [**GetAiTranslateLanguages**](TranslateApi.md#getaitranslatelanguages) | **GET** /ai/translate/languages | 获取AI翻译支持的语言和配置 |
88
| [**PostAiTranslate**](TranslateApi.md#postaitranslate) | **POST** /ai/translate | AI智能翻译 |
9+
| [**PostTranslateStream**](TranslateApi.md#posttranslatestream) | **POST** /translate/stream | 流式翻译(中英互译) |
910
| [**PostTranslateText**](TranslateApi.md#posttranslatetext) | **POST** /translate/text | 多语言文本翻译 |
1011

1112
<a id="getaitranslatelanguages"></a>
@@ -81,6 +82,44 @@ No authorization required
8182

8283
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
8384

85+
<a id="posttranslatestream"></a>
86+
# **PostTranslateStream**
87+
> string PostTranslateStream (PostTranslateStreamRequest postTranslateStreamRequest)
88+
89+
流式翻译(中英互译)
90+
91+
想让翻译结果像打字机一样逐字显示出来?这个流式翻译接口能实现这种效果。 ## 功能概述 不同于传统翻译API一次性返回完整结果,这个接口会实时地、一个字一个字地把翻译内容推给你(就像ChatGPT回复消息那样),非常适合用在聊天应用、直播字幕等需要即时反馈的场景。 ## 它能做什么 - **中英互译**:支持中文和英文之间的双向翻译 - **自动识别**:不确定源语言?设置为 `auto` 让我们自动检测 - **逐字返回**:翻译结果会像打字机一样逐字流式返回,用户体验更流畅 - **音频朗读**:部分翻译结果会附带音频链接,方便朗读 ## 支持的语言 目前专注于中英互译,支持以下选项: - `中文`(简体/繁体) - `英文` - `auto`(自动检测)
92+
93+
94+
### Parameters
95+
96+
| Name | Type | Description | Notes |
97+
|------|------|-------------|-------|
98+
| **postTranslateStreamRequest** | [**PostTranslateStreamRequest**](PostTranslateStreamRequest.md) | 包含翻译参数的JSON对象 | |
99+
100+
### Return type
101+
102+
**string**
103+
104+
### Authorization
105+
106+
No authorization required
107+
108+
### HTTP request headers
109+
110+
- **Content-Type**: application/json
111+
- **Accept**: text/event-stream, application/json
112+
113+
114+
### HTTP response details
115+
| Status code | Description | Response headers |
116+
|-------------|-------------|------------------|
117+
| **200** | SSE流式响应。Content-Type为text/event-stream | - |
118+
| **400** | 请求参数错误 | - |
119+
| **500** | 翻译服务错误 | - |
120+
121+
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
122+
84123
<a id="posttranslatetext"></a>
85124
# **PostTranslateText**
86125
> PostTranslateText200Response PostTranslateText (string toLang, PostTranslateTextRequest postTranslateTextRequest)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# uapi-sdk-csharp.Model.PostTranslateStream400Response
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Error** | **string** | 错误描述 | [optional]
8+
**Code** | **string** | 错误码 | [optional]
9+
10+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# uapi-sdk-csharp.Model.PostTranslateStream500Response
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Error** | **string** | 错误描述 | [optional]
8+
**Code** | **string** | | [optional]
9+
10+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
11+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# uapi-sdk-csharp.Model.PostTranslateStreamRequest
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Query** | **string** | 待翻译的文本内容 |
8+
**ToLang** | **string** | 目标语言,支持:中文、英文 |
9+
**FromLang** | **string** | 源语言,支持:中文、英文、auto(自动检测)。默认为auto | [optional] [default to FromLangEnum.Auto]
10+
**Tone** | **string** | 语气参数,可选 | [optional]
11+
12+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
13+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* UAPI
3+
*
4+
* UAPI 官方接口文档
5+
*
6+
* The version of the OpenAPI document: 1.0.0
7+
* Generated by: https://github.com/openapitools/openapi-generator.git
8+
*/
9+
10+
11+
using Xunit;
12+
13+
using System;
14+
using System.Linq;
15+
using System.IO;
16+
using System.Collections.Generic;
17+
using uapi-sdk-csharp.Model;
18+
using uapi-sdk-csharp.Client;
19+
using System.Reflection;
20+
21+
namespace uapi-sdk-csharp.Test.Model
22+
{
23+
/// <summary>
24+
/// Class for testing PostTranslateStream400Response
25+
/// </summary>
26+
/// <remarks>
27+
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
28+
/// Please update the test case below to test the model.
29+
/// </remarks>
30+
public class PostTranslateStream400ResponseTests : IDisposable
31+
{
32+
// TODO uncomment below to declare an instance variable for PostTranslateStream400Response
33+
//private PostTranslateStream400Response instance;
34+
35+
public PostTranslateStream400ResponseTests()
36+
{
37+
// TODO uncomment below to create an instance of PostTranslateStream400Response
38+
//instance = new PostTranslateStream400Response();
39+
}
40+
41+
public void Dispose()
42+
{
43+
// Cleanup when everything is done.
44+
}
45+
46+
/// <summary>
47+
/// Test an instance of PostTranslateStream400Response
48+
/// </summary>
49+
[Fact]
50+
public void PostTranslateStream400ResponseInstanceTest()
51+
{
52+
// TODO uncomment below to test "IsType" PostTranslateStream400Response
53+
//Assert.IsType<PostTranslateStream400Response>(instance);
54+
}
55+
56+
/// <summary>
57+
/// Test the property 'Error'
58+
/// </summary>
59+
[Fact]
60+
public void ErrorTest()
61+
{
62+
// TODO unit test for the property 'Error'
63+
}
64+
65+
/// <summary>
66+
/// Test the property 'Code'
67+
/// </summary>
68+
[Fact]
69+
public void CodeTest()
70+
{
71+
// TODO unit test for the property 'Code'
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)