To translate "MyGPT — or how the first ChatGPT powered Alexa Skill was born" into simplified Chinese while keeping the HTML structure intact, you can use the following: ```html — 或者第一个由ChatGPT驱动的Alexa技能诞生的故事 ``` This maintains the structure of the original text while providing the simplified Chinese translation.

To translate "This is blog post #1 of a mini series of posts about my Alexa Skill that uses ChatGPT to make Alexa smart." into simplified Chinese while keeping the HTML structure intact, you would write: ```html 这是关于我使用ChatGPT让Alexa变得智能的迷你系列博文中的第一篇博文。 ``` This HTML structure maintains the original text content while allowing it to be displayed correctly on a webpage.

```html

在2023年初,全球仍然被ChatGPT的出现所激动。但出于某种原因,没有人认真尝试将它与Alexa结合起来。这很奇怪,因为ChatGPT是一种纯语言驱动的助手,而Alexa则是一种纯语音控制的助手,只是没有ChatGPT智能。因此,我着手填补这一空白,并在Alexa技能中将两者连接起来。

```

Sure, here's the translated text in simplified Chinese, keeping the HTML structure: ```html

第一个原型做起来相当快速。我已经有一个公开可用的维基百科技能(用Go编写),支持英语、德语和西班牙语。我所需做的只是将其复制一份,并将API调用从维基媒体改为OpenAI的调用。整个过程实际上只用了一天。

```

Sure, here's the translated text in simplified Chinese while maintaining the HTML structure: ```html

哇,结果真是令人惊叹。亚历克莎突然感觉自己像《星际迷航》中的电脑一样了。你可以问她任何事情,进行真正的对话!就像人们第一次使用ChatGPT时的惊讶一样。但现在你可以... 只是聊天!

```

To translate "And so, MyGPT was born." into simplified Chinese, while keeping the HTML structure intact, you can use the following: ```html 于是,MyGPT诞生了。 ``` This HTML code specifies that the text within the `` tag is in simplified Chinese (`lang="zh-CN"`). The translated text "于是,MyGPT诞生了。" means "And so, MyGPT was born."

Sure, here's the translation of the text into simplified Chinese while keeping the HTML structure intact: ```html 如果你想尝试一下,请在继续阅读之前,在这里为你的国家激活它:🇩🇪 | 🇺🇸 | 🇨🇳 | 🇮🇳 | 🇬🇧 | 🇦🇺 | 🇫🇷。这些链接直接指向可以使用名称“ChatGPT”调用的后继技能。 ``` Make sure to use UTF-8 encoding to display the Chinese characters correctly on your webpage.

The MyGPT logo (later also used for its sibling skill “Chatbot powered by ChatGPT”)

```html 回到实现上,实际上这并不是那么容易。原型确实能工作,但它有很多问题。这些问题大多与如何处理来自 OpenAI 的慢响应以及一般网络连接问题有关。为了在 Alexa 的响应上达到 100% 的成功率,我不得不解决很多微妙的问题。本文的其余部分将解释这些问题。 ```

To translate the provided text into simplified Chinese while keeping the HTML structure intact, you can use the following code: ```html

关于什么是Alexa Skill及其工作原理的一些背景:Alexa Skills相当于智能手机上的应用程序。用户需要显式激活它们,并且它们会通过用户说出类似“Alexa,打开我的百科全书”的指令来调用。

``` This HTML snippet will display the translated text in simplified Chinese, formatted as a paragraph. Make sure to properly encode and set the document's character encoding to UTF-8 to ensure correct display of Chinese characters.

```html

一个 Alexa 技能的工作方式是这样的:当用户询问:“Alexa,请问 MyGPT 巴黎铁塔有多高”,设备会将音频发送到 Alexa 服务,Alexa 服务会进行转录(语音转文本),确定这是对特定技能的请求,将其发送到技能的端点,在 MyGPT 的情况下是一个 AWS Lambda 函数,并将包含用户话语的 JSON 负载传递给它。现在 Alexa 服务将等待来自端点的响应,最多等待 8 秒钟。也就是说,JSON 响应负载将包括 Alexa 应该向用户朗读的文本。如果在 8 秒内没有收到响应,Alexa 将告知用户技能存在错误并结束会话。

``` This HTML structure maintains the text while providing a simple translation into Simplified Chinese.

Certainly! Here's the translation of the English text into simplified Chinese while maintaining the HTML structure: ```html

在这里需要注意的是,Alexa 没有流媒体选项可用。它采用经典的同步请求/响应模型。至少大多数情况是这样的。但我们马上就会讨论这一点。

``` This HTML snippet now contains the translated text in simplified Chinese, enclosed within `

` tags for paragraph formatting.

```html

OpenAI,然而,确实提供了流式API。因此,我们可以向OpenAI发出HTTP请求,并收集令牌,直到过了7.5秒(留有一点时间缓冲,以防万一),在这里断开连接,并将到目前为止收到的内容发送回给用户。不过,这并不是一个很好的用户体验。相反地,我们需要在句子的结尾处切断。在Go语言中,有一个方便的库可以识别句子的结尾:neurosnap/sentences。有了它,Alexa可以给出正确的语调回应,因为它由完整的句子组成。我们还知道答案是否不完整,因为我们切断了从OpenAI返回的响应。当答案不完整时,我们需要询问用户是否想继续听。

```

Sure, here is the translation of the text into simplified Chinese while keeping the HTML structure intact: ```html

解决了由于超时而导致会话结束时出现错误的问题。然而,询问用户是否想要听更多内容,确实是关于这个技能的一个具有争议性的设计选择。事实上,人们经常抱怨这一点,想知道为什么技能不继续讲下去。不幸的是,我认为在Alexa的8秒限制和OpenAI提供的有限吞吐量下,没有完美的解决方案。所以我采取了这种方式。

``` This translation maintains the original content and structure while translating it into simplified Chinese.

```html

体验还不理想的另一个原因是:对于某些答案,你可能需要等待接近8秒,尽管OpenAI早已提供了部分回应。在与助手交流时,等待8秒可能会感觉像是漫长的等待。实际上,这是不可接受的。通过一些搜索发现,有一种方法可以将响应“流式传输”给Alexa。这并不是真正的流式传输,而是可以使用Alexa的API发送“渐进式响应”。也就是说,在提供最终答案之前,你可以向用户发送部分响应。因此,我改变了实现方式,不仅仅是遍历从OpenAI接收到的标记并收集它们,还每秒发送一次包括到目前为止接收到的所有完整句子的部分响应。

```

Sure, here's the translated text in simplified Chinese, keeping the HTML structure intact: ```html

那个效果非常好!只剩下一个小问题:由于某种原因,Alexa 在朗读渐进响应时的音量比最终响应要小。这听起来确实很尴尬,因为她似乎会在为你提供的最后一部分响应时开始对你大声喊叫。当然,修复方法很简单:在响应中使用音量属性来调高渐进响应的音量。

``` This HTML snippet contains the translated text in simplified Chinese, formatted for display in an HTML document.
Showing the median and p90 response time in milliseconds (not including progressive responses; these are even faster). As we can see, the median is mostly below 2.5s. It also shows that the slowest 10% requests can easily go to 7s and above.

在这一点上,我觉得技能已经足够好,可以发布了。于是我提交了它,现在它在英国和德国的六个不同国家都可以使用(它的姐妹产品“由ChatGPT提供支持的聊天机器人”也支持法语,并且在7个国家可用)。

To translate the provided English text into simplified Chinese while keeping the HTML structure intact, you can use the following: ```html

这个经历依然不完美。偶尔,OpenAI 变得如此缓慢,以至于在过了1秒、2秒或3秒之后,甚至连一个句子都不可用。经过一些试验后,我在这种情况下插入了一些“嗯…嗯…”。然而,人们对此感到恼火,因为这种情况发生得比我想象的要频繁。最终,我把它改成了一个轻微的提示音。

``` This HTML snippet translates the text into simplified Chinese and preserves the original structure for integration into a webpage or document.

```html

最后,还有一些错误情况,HTTP连接会无响应。我花了很长时间才明白发生了什么。幸运的是,Go语言的HTTP客户端有一个直观的配置参数叫做超时(timeout)。将其设置为7秒确保客户端能及时退出,使技能能够告知用户出现问题,并询问他们是否希望技能重试。

```

To translate the provided English text into simplified Chinese while maintaining HTML structure, you can use the following: ```html HTTP错误是另一个问题。我发现处理所有这些问题最简单的方法是使用HashiCorp出色的go-retryablehttp库,并将重试等待时间设置为非常低的值,仅重试两次。只有这种设置才能让我们快速地再次尝试或完全退出。 ``` This translation keeps the structure of the original HTML intact while providing the Chinese translation for the text content.

retryableHttpClient := retryablehttp.NewClient()

retryableHttpClient.HTTPClient.Timeout = 7000 * time.Millisecond
retryableHttpClient.RetryMax = 2
retryableHttpClient.RetryWaitMin = 10 * time.Millisecond
retryableHttpClient.RetryWaitMax = 50 * time.Millisecond

```html 最后,为了确保无论出于何种原因都绝对不会挂起,我们将所有内容都包裹在带有定时器的选择语句中: ```

chatCompletionTimer := time.NewTimer(7500 * time.Millisecond)
fullSentencesSinceLastProgressiveResponseChan := make(chan string, 1)
entireSpeechChan := make(chan string, 1)

go func() {
// get the actual responses from ChatGPT ...
// write to fullSentencesSinceLastProgressiveResponseChan,
// entireSpeechChan
}()

var fullSentencesSinceLastProgressiveResponse, entireSpeech string
select {
case <-chatCompletionTimer.C:
fullSentencesSinceLastProgressiveResponse = l.Get(r.TakingLongerToGetResponse)
entireSpeech = fullSentencesSinceLastProgressiveResponse
case fullSentencesSinceLastProgressiveResponse = <-fullSentencesSinceLastProgressiveResponseChan:
entireSpeech = <-entireSpeechChan
chatCompletionTimer.Stop()
}

Sure, here's the simplified Chinese translation of the text while keeping the HTML structure intact: ```html

通过这些改变,我的响应成功率达到了100%。没有超时,没有错误。

``` In this HTML snippet: - `

` denotes a paragraph tag. - `通过这些改变,我的响应成功率达到了100%。没有超时,没有错误。` is the translated text in simplified Chinese.

Here's the translated text in simplified Chinese, keeping the HTML structure intact: ```html

这篇文章就到这里了。在接下来的文章中,我将会谈到我是如何引入反馈功能、用户的挫折感、一个新的技能名称、不同的语音等等。

```

在保留HTML结构的情况下,将以下英文文本翻译为简体中文: "再次,如果你想试用,请在这里为你的国家激活它:"

To translate the text "🇩🇪 | 🇺🇸 | 🇨🇦 | 🇮🇳 | 🇬🇧 | 🇦🇺 | 🇫🇷 ." into simplified Chinese while keeping the HTML structure, you would use the following code: ```html 🇩🇪 | 🇺🇸 | 🇨🇦 | 🇮🇳 | 🇬🇧 | 🇦🇺 | 🇫🇷 . ``` This HTML code specifies that the content inside the `` tag is in simplified Chinese (`zh-Hans`). It keeps the structure intact while ensuring the text is displayed correctly in the intended language.

2024-07-08 04:21:35 AI中文站翻译自原文