Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Feat/application api add speech to text (#655)

zxhlyhae7c0380dc62
diff --git a/web/app/components/develop/template/template_chat.en.mdx b/web/app/components/develop/template/template_chat.en.mdx
index 7e6c6644491..a3af2f6e349 100644
--- a/web/app/components/develop/template/template_chat.en.mdx
+++ b/web/app/components/develop/template/template_chat.en.mdx
@@ -380,6 +380,48 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
</Col>
</Row>
+---
+
+<Heading
+ url='/audio-to-text'
+ method='POST'
+ title='speech to text'
+ name='#audio'
+/>
+<Row>
+ <Col>
+ Speech to text, only supports openai model.
+
+ ### Request Body
+
+ <Properties>
+ <Property name='file' type='file' key='file'>
+ Audio file.
+ File uploads are currently limited to 15 MB and the following input file types are supported: mp3, mp4, mpeg, mpga, m4a, wav, and webm.
+ </Property>
+ </Properties>
+ </Col>
+ <Col sticky>
+
+ <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}>
+
+ ```bash {{ title: 'cURL' }}
+ curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/name' \
+ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
+ --form 'file=@localfile;type=audio/mp3'
+ ```
+
+ </CodeGroup>
+
+ <CodeGroup title="Response">
+ ```json {{ title: 'Response' }}
+ {
+ "text": ""
+ }
+ ```
+ </CodeGroup>
+ </Col>
+</Row>
---
diff --git a/web/app/components/develop/template/template_chat.zh.mdx b/web/app/components/develop/template/template_chat.zh.mdx
index 3dc70a43a6d..1e194e6cfa4 100644
--- a/web/app/components/develop/template/template_chat.zh.mdx
+++ b/web/app/components/develop/template/template_chat.zh.mdx
@@ -379,6 +379,48 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col>
</Row>
+---
+
+<Heading
+ url='/audio-to-text'
+ method='POST'
+ title='语音转文字'
+ name='#audio'
+/>
+<Row>
+ <Col>
+ 语音转文字,仅支持 openai 模型。
+
+ ### Request Body
+
+ <Properties>
+ <Property name='file' type='file' key='file'>
+ 语音文件。
+ 文件上传当前限制为 15 MB,并且支持以下输入文件类型:mp3、mp4、mpeg、mpga、m4a、wav 和 webm。
+ </Property>
+ </Properties>
+ </Col>
+ <Col sticky>
+
+ <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}>
+
+ ```bash {{ title: 'cURL' }}
+ curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/name' \
+ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
+ --form 'file=@localfile;type=audio/mp3'
+ ```
+
+ </CodeGroup>
+
+ <CodeGroup title="Response">
+ ```json {{ title: 'Response' }}
+ {
+ "text": ""
+ }
+ ```
+ </CodeGroup>
+ </Col>
+</Row>
---