diff --git a/docs/Serverless API-integrated.md b/docs/Serverless API-integrated.md new file mode 100644 index 0000000000000000000000000000000000000000..a473bdafd663c3988673cf96d54cad576b91afd6 --- /dev/null +++ b/docs/Serverless API-integrated.md @@ -0,0 +1,193 @@ +# Serverless API 应用集成指南 + +[Serverless API](https://ai.gitee.com/serverless-api) 提供了五大类、数十个模型 API,只需调用 API 就可以将其强大的能力集成到您的应用中。本文为大家推荐了一些可集成 Serverless API 的应用,以及详细的集成配置指南。 + +这些应用运行我们日常使用的平台上,如 Windows、mac 上的客户端、网页应用、浏览器插件,移动端 APP 等,通过使用这些应用,即可释放 Serverless API 的模型能力,从而提升您使用 AI 的便捷性。以下是应用的访问地址和简介: + +| 分类 | 应用名称 | 简介 | +| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| 客户端类 | [Chatbox](https://chatboxai.app/zh) | 一个支持多种流行LLM模型的桌面客户端,可在 Windows、Mac 和 Linux 上使用 | +| | [OpenCat](https://opencat.app/zh-Hans/) | OpenCat 是一个 AI 对话聊天客户端,支持 ios 和 MacOS | +| | [Dify](https://dify.ai/) | 一款开源的大语言模型(LLM) 应用开发平台。它融合了后端即服务和 [LLMOps](https://docs.dify.ai/v/zh-hans/learn-more/extended-reading/what-is-llmops) 的理念,使开发者可以快速搭建生产级的生成式 AI 应用 | +| | [Nextchat](https://nextchat.dev/) | 只需轻点几下,就能在自己的服务器上搭建聊天服务 | +| | [Pal Chat ](https://apps.apple.com/us/app/pal-chat-ai-chat-client/id6447545085) | 一款可以在 iPhone 或 iPad 上使用的 AI 助手 | +| | [Enconvo](https://www.enconvo.com/) | Enconvo是 AI 时代的启动器,是所有AI功能的入口,也是一位体贴的智能助理.】 | +| | [Cherry Studio](https://www.cherrystudios.com/) | 一款为创造者而生的桌面版 AI 助手 | +| 浏览器插件 | [沉浸式翻译](https://immersivetranslate.com/zh-Hans/) | 一款双语对照网页翻译插件,简洁,高效 | +| | [ChatGPT Box](https://github.com/josStorer/chatGPTBox) | 将 LLM 作为私人助手,整合到你的浏览器中 | +| | [划词翻译](https://hcfy.app/) | 整合了多家翻译 API 以及 LLM API 的浏览器翻译插件 | +| | [欧路翻译](https://chromewebstore.google.com/detail/%E6%AC%A7%E8%B7%AF%E7%BF%BB%E8%AF%91-%E7%BD%91%E9%A1%B5%E5%88%92%E8%AF%8D%E7%BF%BB%E8%AF%91%E5%B7%A5%E5%85%B7/djbfechcnkppbknmlhfcaoifgnicolin) | 提供鼠标划词搜索、逐段对照翻译、PDF文献翻译功能。可以使用支持 DeepSeek AI, Bing、GPT、Google 等多种翻译引擎 | +| IM 助手 | [茴香豆](https://github.com/InternLM/HuixiangDou/blob/main/README_zh.md) | 一个集成到个人微信群/飞书群的领域知识助手,专注解答问题不闲聊 | +| | [QChatGPT](https://github.com/RockChinQ/QChatGPT) | 高稳定性、支持插件、实时联网的 LLM QQ / QQ频道 / One Bot 机器人 | +| VScode 插件 | [Continue](https://github.com/continuedev/continue) | 开源 IDE 插件,使用 LLM 做你的编程助手 | + + +以上应用均支持集成 Serverless API,配置操作也很简单,在选择 API 配置的时候,因为 Serverless API 与 OpenAI API 格式兼容,模型提供方只需要选择 OpenAl APl Compatible 。这个时候通常需要填写 API 调用地址、API key 等信息,下面是操作步骤: + +## 操作步骤 + +1. **获取** **API** **路径:** + +请在 Serverless API 页选择你想要使用的模型,点击调用,获取它的 API 调用地址,如下所示: + +_https://ai.gitee.com/api/inference/serverless/__resource__(示例)/chat/completions_ + +![alt text](/img/serverless-api/integrated/integrate1.png) + + +2. 通过上面获取的路径,通常需要将路径拆分,填写下方信息: + +- API Host (Domain):_https://ai.gitee.com/_ +- API Path:_api/inference/serverless/__resource__(示例)/chat/completions_ + +![alt text](/img/serverless-api/integrated/integrate2.png) + +3. 获取 API key: + +前往 Gitee AI 工作台 - 设置 - 访问令牌,创建你的 API Key + +![alt text](/img/serverless-api/integrated/integrate3.png) + + + +## 集成 OpenCat + +OpenCat 是一个 AI 对话聊天客户端,支持 ios 和 MacOS,在对话框内,可以快速的使用 prompt,展开新的对话,通过对接一些主流平台的 API ,可以选择与多种模型聊天。 + +### 配置指南 + +1. 下载 [OpenCat](https://opencat.app/zh-Hans/) + +2. 进入setting——Providers + +3. 输入 API Domain、API Path、API Key + + - API Domain:https://ai.gitee.com/ + + - API Path:不同模型的路径不同,示例:_api/inference/serverless/__resource__(示例)/chat/completions_ + + - API key: 在 Gitee AI 工作台-设置复制访问令牌(API key) + +4. 点击验证,提示 Validate Success 即可 + + +![alt text](/img/serverless-api/integrated/integrate4.png) + + + +## 集成沉浸式翻译 + +[Immersive Translate](https://immersivetranslate.com/) 是一款浏览器插件,专注于提供高效的双语对照翻译服务。它支持网页、PDF、EPUB 等多种格式的翻译,能够实时翻译外语内容,并支持视频双语字幕翻译。插件提供了便捷的鼠标悬停翻译和输入框翻译功能,是提升信息获取效率的利器。 + + + +### **配置指南** + +1. 安装成功后,进入 Immersive Translate 插件 - “翻译服务”,滑到最底部添加自定义翻译服务。 + + +![alt text](/img/serverless-api/integrated/integrate5.png) + +2. 在设置页面输入以下关键信息: + + +- 自定义 API 接口地址: _此处填写 Serverless API 完整的调用地址_ + +- APIKEY:在 Gitee AI 工作台-设置复制访问令牌(API key) + +- 每秒最大请求数:1 + +- 每次请求最大文本长度:1200 + +- 每次请求最大段落数:8 + + +3. 点击页面上方“点此测试服务”,显示“验证成功”即配置完成 + +![alt text](/img/serverless-api/integrated/integrate6.png) + + + + + +## 集成 Dify + +Dify 是一款开源的大语言模型(LLM) 应用开发平台。它融合了后端即服务(Backend as Service)和 [LLMOps](https://docs.dify.ai/v/zh-hans/learn-more/extended-reading/what-is-llmops) 的理念,使开发者可以快速搭建生产级的生成式 AI 应用。即使是非技术人员,也能参与到 AI 应用的定义和数据运营过程中。 + +### 配置指南 + +Serverless API 支持在 Dify 中调用,使用步骤如下 + +1. [登录 dify](https://cloud.dify.ai/),并按照下图操作,进入 API 配置页面 + + +![alt text](/img/serverless-api/integrated/integrate7.png) + + + +2. 填写 API 信息配置 + + - 模型名称:无格式要求 + + - API key:在 Gitee AI 工作台-设置复制访问令牌(API key) + + - API endpoint URL:在 Serverless API 调用窗口获取,此处无需粘贴 /chat/completions + + - Completion mode:选择对话类型 + + - 点击保存,保存会触发请求,保存成功即可使用 + + +![alt text](/img/serverless-api/integrated/integrate8.png) + + +![alt text](/img/serverless-api/integrated/integrate9.png) + + + +## 集成 Nextchat + +[Nextchat](https://nextchat.dev/) 是一款网页端的 AI 对话工具,支持自定义大模型。还支持在自己的服务器上搭建聊天服务。 + +### 配置指南 + +1. 点击设置,并滚动至自定义接口,选择 OpenAI + +2. Serverless API 链接,在调用窗口获取,填写完整 URL,示例:_https://ai.gitee.com/api/inference/serverless/ZBQ2F4KXXXX/chat/completions_ + + +![alt text](/img/serverless-api/integrated/integrate10.png) + + + +3. 最后,创建新聊天,点击对话设置,选择刚刚配置的模型,就可以在对话框内调用模型了。 + +![alt text](/img/serverless-api/integrated/integrate11.png) + +![alt text](/img/serverless-api/integrated/integrate12.png) + + + +## 集成 ChatGPTBox + +[ChatGPT Box](https://github.com/josStorer/chatGPTBox) 是一款浏览器插件,支持在浏览器内随时呼出 AI 对话框,并适用于手机端浏览器。支持自定义模型 API,它还提供框选内容执行任务、静态卡片浮出聊天框、代码高亮和复杂公式渲染、对话记录保存等功能。 + + + +### 配置指南 + +下载 ChatGPTBox 并安装成功后,点击插件图标,按照以下要求操作: + + - 选择自定义模型 + + - 模型名称无严格要求 + + - API 地址:填写完整的 Serverless API 地址 + + - API key:在 Gitee AI 工作台-设置复制访问令牌(API key) + +![alt text](/img/serverless-api/integrated/integrate13.png) + + + +更多应用,请查看文章顶部表格,如有疑问或建议,请随时[联系我们](https://ai.gitee.com/about)。 diff --git a/docs/Serverless API-voice url.md b/docs/Serverless API-voice url.md index c436736856802aa762c18d3c067addf8a23f64f9..41b132c4df09d71652caf4e1215ad827983c7100 100644 --- a/docs/Serverless API-voice url.md +++ b/docs/Serverless API-voice url.md @@ -1,51 +1,99 @@ -# 使用语音生成模型克隆声音 +# 语音生成模型-声纹参数配置指南 -目前 Serverless API 的语音生成模型 [CosyVoice-300M](https://ai.gitee.com/serverless-api?service=720)、[ChatTTS](https://ai.gitee.com/serverless-api?service=135)、[fish-speech-1.2-sft](https://ai.gitee.com/serverless-api?service=865) 支持识别音频样本来克隆声音,您可以录制想要克隆的声音样本,生成与样本音色一致的声音。可用于定制化语音助手,虚拟角色声音制作等。 +## 基本介绍 + +目前 Serverless API 的语音生成模型 [CosyVoice-300M](https://ai.gitee.com/serverless-api?service=720)、[ChatTTS](https://ai.gitee.com/serverless-api?service=135)、[fish-speech-1.2-sft](https://ai.gitee.com/serverless-api?service=865) 支持识别音频的声音数据生成和样本一致的声音。可用于定制化语音助手,虚拟角色声音制作等。 ![alt text](/img/serverless-api/voiceurl1.png) -您可以在语音生成模型的参数设置中配置 voice_url ,以 url 的形式传递 .pt 格式的声纹文件给模型,从而生成和文件中声音特征一致的音频。 - .pt 格式的声纹文件,可以通过录制音频文件转制而成,不同模型所要求的声纹文件不同,对于 CosyVoice-300M 和 fish-speech-1.2-sft 模型可使用 Gitee AI 提供的声纹文件接口制作,而 ChatTTS 可使用 ChatTTS 声音克隆工具 http://region-9.autodl.pro:41137/ 制作。 +## 简要操作步骤 + +只需在语音生成模型的参数设置中配置 voice_url ,以 url 的形式传递 .pt 格式的声纹文件给模型,即可生成和文件中声音特征一致的音频。主要包括以下几个关键步骤: + +1. 制作.pt 格式的声纹文件,可以通过音频文件转制而成,不同模型所要求的声纹文件不同: +- CosyVoice-300M 和 fish-speech-1.2-sft 模型可使用 Gitee AI 提供的声纹文件接口制作。 +- ChatTTS 可使用 ChatTTS 声音克隆工具 http://region-9.autodl.pro:41137/ 制作。 + +2. 将制作好的 .pt 格式的声纹文件,存放在公开可下载的地址,比如放在您的 Gitee 代码仓库中。 -如果您已经制作好了 .pt 格式的声纹文件,只需将其存放在公开可下载的地址,并复制下载地址至下图模型中的 voice_url 参数,输入文本并运行,即可生成与文件音色一致的声音。 +3. 复制下载地址至下图模型中的 voice_url 参数,最后输入文本并运行,就能生成与文件音色一致的声音了。 ![alt text](/img/serverless-api/voiceurl2.png) -下面是详细的声纹文件制作指南: +## 详细操作步骤: -## 步骤1:制作.pt 格式的声纹文件 +### 步骤1:制作.pt 格式的声纹文件 -**1.制作音频文件** +#### **1.1 制作音频文件** 使用录音软件录制普通话且吐字清晰的音频,时长建议保持在 5-15 秒,文件格式为 .mp3 或 .m4a ,建议文件不易过大。 -**2.生成 CosyVoice-300M 和 fish-speech-1.2-sft 模型的声纹文件** -将音频文件上传至 Gitee AI 提供的声纹文件接口,Authorization 参数输入 Gitee AI 的访问令牌,prompt_text 是和录音内容一致的文字描述,请求成功后,接口会返回声纹文件,下载并修改文件格式为.pt即可。 +#### **1.2 生成 CosyVoice-300M 和 fish-speech-1.2-sft 模型的声纹文件** + +将音频文件上传至 Gitee AI 提供的声音特征提取接口,下面是接口的详细说明: + +**接口名** + +voiceFeatureExtraction -```Plain -curl +**功能描述** + +该接口用于处理音频文件,提取关键音频特征 + +**注意事项** +- 文件大小限制:小于 5 M +- 支持的音频格式:.mp3 或 .m4a +- 该接口可以提取音频中的关键特征用于后续处理和分析 + +**调用方式** + +HTTPS 调用 + +``` +POST https://ai.gitee.com/api/inference/serverless/PH5EDMEALV1D/voice-feature-extraction +``` + + +**请求参数** + +| 参数位置 | 名称 | 类型 | 必填 | 说明 | +|----------|---------------|--------|------|----------------------------------------------------------------------------------------| +| Header | Authorization | string | 是 | 访问令牌,可在工作台->设置->访问令牌,进行生成获取。值格式:"Bearer access_token",示例值:"Bearer t-g1044qeGEDXTB6NDJOGV4JQCYDGHRBARFTGT1234" | +| form-data| file | file | 是 | 语音内容。注意:Content-Type为application/octet-stream,示例值: 二进制文件 | +| form-data| prompt_text | string | 是 | 提词内容。注意:与录音内容一致的文字描述。 | + + +**返回参数** + +HTTP状态码为 200 时,表示成功。返回文件二进制流。 + + +**Curl示例** + +```curl --location --request POST 'https://ai.gitee.com/api/inference/serverless/PH5EDMEALV1D/voice-feature-extraction' --header 'Authorization: Bearer 输入你的 Gitee AI 访问令牌 ' --form 'file=@"上传.mp3 或.m4a格式的文件"' --form 'prompt_text="和录音内容一致的文字描述“’ ``` -以下是使用 APIfox 接口工具制作声纹文件的操作,您也可以选择自己熟悉的工具请求接口。 - 1) 新建接口井输入接口地址. +**使用 APIfox 接口工具请求示例** + + 1) 新建接口井输入接口地址。 - 2) 添加 Authorization 参数,参数值可以在 Gitee Al 工作台-访问令牌获取. + 2) 添加 Authorization 参数,参数值可以在 Gitee Al 工作台-访问令牌获取。 - 3) 选择 Body - form-data . + 3) 选择 Body - form-data 。 - 4) 添加 file 参数,并上传音频文件. + 4) 添加 file 参数,并上传音频文件。 - 5) 添加 prompt_text 參数,參数值是和录音内容一致的文字描述,添加完成后点击发送. + 5) 添加 prompt_text 參数,參数值是和录音内容一致的文字描述,添加完成后点击发送。 - 6) 请求成功后,下载接口返回的文件,并修改文件名为 xxxx.pt. + 6) 请求成功后,下载接口返回的文件,并修改文件名为 xxxx.pt。 ![alt text](/img/serverless-api/voiceurl3.png) @@ -53,7 +101,8 @@ curl ![alt text](/img/serverless-api/voiceurl5.png) - **3. 生成 ChatTTS 模型的声纹文件** +#### **1.3 生成 ChatTTS 模型的声纹文件** + 1) 访问 Chattts 的声音克隆工具 http://region-9.autodl.pro:41137/ @@ -68,7 +117,7 @@ curl ![alt text](/img/serverless-api/voiceurl5-2.png) -## 步骤2:上传声纹文件并获取下载地址 +### 步骤2:上传声纹文件并获取下载地址 语音生成模型的 voice_url 参数需要读取声纹文件,所以我们需要将声纹文件上传至网盘或其他可下载的公共空间,并获取文件下载的 url,配置到语音模型的 voice_url 参数即可。 @@ -78,7 +127,7 @@ curl ![alt text](/img/serverless-api/voiceurl7.png) ![alt text](/img/serverless-api/voiceurl8.png) -## 步骤3:在模型参数中粘贴地址 +### 步骤3:在模型参数中粘贴地址 根据您生成的 pt 文件类型,选择 [CosyVoice-300M](https://ai.gitee.com/serverless-api?service=720)、[ChatTTS](https://ai.gitee.com/serverless-api?service=135)、[fish-speech-1.2-sft](https://ai.gitee.com/serverless-api?service=865) ,粘贴声纹文件下载地址到 voice_url 参数,输入文字并运行。即可生成和声纹音色一致的声音。 diff --git a/sidebars.ts b/sidebars.ts index a3188beb9bce1fc7712543aa80023e156423513c..79b14d2e92be5933c76059ef6d34f618c02d217a 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -181,6 +181,11 @@ const sidebars: SidebarsConfig = { type: 'doc', id: 'Serverless API-voice url', }, + + { + type: 'doc', + id: 'Serverless API-integrated', + }, ], }, diff --git a/static/img/serverless-api/integrated/integrate1.png b/static/img/serverless-api/integrated/integrate1.png new file mode 100644 index 0000000000000000000000000000000000000000..f8a6744ca4b2dd95e302ae4faa1fb450a4740cdb Binary files /dev/null and b/static/img/serverless-api/integrated/integrate1.png differ diff --git a/static/img/serverless-api/integrated/integrate10.png b/static/img/serverless-api/integrated/integrate10.png new file mode 100644 index 0000000000000000000000000000000000000000..8594fddc923dba8436f6b2ed1ba63adcee2a4bbf Binary files /dev/null and b/static/img/serverless-api/integrated/integrate10.png differ diff --git a/static/img/serverless-api/integrated/integrate11.png b/static/img/serverless-api/integrated/integrate11.png new file mode 100644 index 0000000000000000000000000000000000000000..5825e5545bea8315bc052cd241da39bf1eb79af4 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate11.png differ diff --git a/static/img/serverless-api/integrated/integrate12.png b/static/img/serverless-api/integrated/integrate12.png new file mode 100644 index 0000000000000000000000000000000000000000..c5461424d99916c225a1efc97fe52dbf4096ad75 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate12.png differ diff --git a/static/img/serverless-api/integrated/integrate13.png b/static/img/serverless-api/integrated/integrate13.png new file mode 100644 index 0000000000000000000000000000000000000000..1fa34a6a33b2bf92ed9245f7ee660c0e5fb0d95d Binary files /dev/null and b/static/img/serverless-api/integrated/integrate13.png differ diff --git a/static/img/serverless-api/integrated/integrate2.png b/static/img/serverless-api/integrated/integrate2.png new file mode 100644 index 0000000000000000000000000000000000000000..cc89ca019d713ac5cc38f3beeb007091ef2e590d Binary files /dev/null and b/static/img/serverless-api/integrated/integrate2.png differ diff --git a/static/img/serverless-api/integrated/integrate3.png b/static/img/serverless-api/integrated/integrate3.png new file mode 100644 index 0000000000000000000000000000000000000000..d63802afbbca823f14de6504d9dc8fa911229ba6 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate3.png differ diff --git a/static/img/serverless-api/integrated/integrate4.png b/static/img/serverless-api/integrated/integrate4.png new file mode 100644 index 0000000000000000000000000000000000000000..e736f798f6fb39fb88ecdab734e957efd1720dfb Binary files /dev/null and b/static/img/serverless-api/integrated/integrate4.png differ diff --git a/static/img/serverless-api/integrated/integrate5.png b/static/img/serverless-api/integrated/integrate5.png new file mode 100644 index 0000000000000000000000000000000000000000..23028f1ba7fa3e8273dbe69161aa2acd37df003f Binary files /dev/null and b/static/img/serverless-api/integrated/integrate5.png differ diff --git a/static/img/serverless-api/integrated/integrate6.png b/static/img/serverless-api/integrated/integrate6.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc0258f466814027fa13f1521d56f23bc2fbdb6 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate6.png differ diff --git a/static/img/serverless-api/integrated/integrate7.png b/static/img/serverless-api/integrated/integrate7.png new file mode 100644 index 0000000000000000000000000000000000000000..8c3854738f94411ef00e753c0d31cc1ec310e4c0 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate7.png differ diff --git a/static/img/serverless-api/integrated/integrate8.png b/static/img/serverless-api/integrated/integrate8.png new file mode 100644 index 0000000000000000000000000000000000000000..025146d1c30d00e621c2b9a75ec20301b3421e92 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate8.png differ diff --git a/static/img/serverless-api/integrated/integrate9.png b/static/img/serverless-api/integrated/integrate9.png new file mode 100644 index 0000000000000000000000000000000000000000..3a6135b625e7c5ab3ef0fcecb332711db11ae0b7 Binary files /dev/null and b/static/img/serverless-api/integrated/integrate9.png differ