refactor(api-access): refactor code group (#24565)

Refactor CodeGroup component on the API Access page.
Fix example tab switching.
This commit is contained in:
Nite Knite
2025-08-26 18:25:08 +08:00
committed by GitHub
parent 58165c3951
commit a2598fd134
13 changed files with 2388 additions and 2676 deletions

View File

@@ -7,10 +7,11 @@ import {
useRef, useRef,
useState, useState,
} from 'react' } from 'react'
import { Tab, TabList, TabPanel, TabPanels } from '@headlessui/react' import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/react'
import { Tag } from './tag' import { Tag } from './tag'
import classNames from '@/utils/classnames' import classNames from '@/utils/classnames'
import { writeTextToClipboard } from '@/utils/clipboard' import { writeTextToClipboard } from '@/utils/clipboard'
import type { PropsWithChildren, ReactElement, ReactNode } from 'react'
const languageNames = { const languageNames = {
js: 'JavaScript', js: 'JavaScript',
@@ -28,11 +29,6 @@ type IChildrenProps = {
[key: string]: any [key: string]: any
} }
function getPanelTitle({ className }: { className: string }) {
const language = className.split('-')[1]
return languageNames[language] ?? 'Code'
}
function ClipboardIcon(props: any) { function ClipboardIcon(props: any) {
return ( return (
<svg viewBox="0 0 20 20" aria-hidden="true" {...props}> <svg viewBox="0 0 20 20" aria-hidden="true" {...props}>
@@ -66,7 +62,7 @@ function CopyButton({ code }: { code: string }) {
<button <button
type="button" type="button"
className={classNames( className={classNames(
'group/button absolute right-4 top-3.5 overflow-hidden rounded-full py-1 pl-2 pr-3 text-2xs font-medium opacity-0 backdrop-blur transition focus:opacity-100 group-hover:opacity-100', 'group/button absolute right-4 top-1.5 overflow-hidden rounded-full py-1 pl-2 pr-3 text-2xs font-medium opacity-0 backdrop-blur transition focus:opacity-100 group-hover:opacity-100',
copied copied
? 'bg-emerald-400/10 ring-1 ring-inset ring-emerald-400/20' ? 'bg-emerald-400/10 ring-1 ring-inset ring-emerald-400/20'
: 'hover:bg-white/7.5 dark:bg-white/2.5 bg-white/5 dark:hover:bg-white/5', : 'hover:bg-white/7.5 dark:bg-white/2.5 bg-white/5 dark:hover:bg-white/5',
@@ -100,7 +96,7 @@ function CopyButton({ code }: { code: string }) {
) )
} }
function CodePanelHeader({ tag, label }: { tag: string; label: string }) { function CodePanelHeader({ tag, label }: { tag?: string; label?: string }) {
if (!tag && !label) if (!tag && !label)
return null return null
@@ -121,38 +117,55 @@ function CodePanelHeader({ tag, label }: { tag: string; label: string }) {
) )
} }
type ICodePanelProps = { type CodeExample = {
children: React.ReactNode title?: string
tag?: string tag?: string
code?: string code: string
label?: string
targetCode?: string
} }
function CodePanel({ tag, label, code, children, targetCode }: ICodePanelProps) {
const child = Children.only(children) type ICodePanelProps = {
children?: React.ReactNode
tag?: string
label?: string
code?: string
title?: string
targetCode?: CodeExample
}
function CodePanel({ tag, label, children, targetCode }: ICodePanelProps) {
const child = Children.toArray(children)[0] as ReactElement<any>
return ( return (
<div className="dark:bg-white/2.5 group"> <div className="dark:bg-white/2.5 group">
<CodePanelHeader <CodePanelHeader
tag={child.props.tag ?? tag} tag={tag}
label={child.props.label ?? label} label={label}
/> />
<div className="relative"> <div className="relative">
{/* <pre className="p-4 overflow-x-auto text-xs text-white">{children}</pre> */} {/* <pre className="p-4 overflow-x-auto text-xs text-white">{children}</pre> */}
{/* <CopyButton code={child.props.code ?? code} /> */} {/* <CopyButton code={child.props.code ?? code} /> */}
{/* <CopyButton code={child.props.children.props.children} /> */} {/* <CopyButton code={child.props.children.props.children} /> */}
<pre className="overflow-x-auto p-4 text-xs text-white">{targetCode || children}</pre> <pre className="overflow-x-auto p-4 text-xs text-white">
<CopyButton code={targetCode || child.props.children.props.children} /> {targetCode?.code ? (
<code>{targetCode?.code}</code>
) : (
child
)}
</pre>
<CopyButton code={targetCode?.code ?? child.props.children.props.children} />
</div> </div>
</div> </div>
) )
} }
function CodeGroupHeader({ title, children, selectedIndex }: IChildrenProps) { type CodeGroupHeaderProps = {
const hasTabs = Children.count(children) > 1 title?: string
tabTitles?: string[]
selectedIndex?: number
}
if (!title && !hasTabs) function CodeGroupHeader({ title, tabTitles, selectedIndex }: CodeGroupHeaderProps) {
return null const hasTabs = (tabTitles?.length ?? 0) > 1
return ( return (
<div className="flex min-h-[calc(theme(spacing.12)+1px)] flex-wrap items-start gap-x-4 border-b border-zinc-700 bg-zinc-800 px-4 dark:border-zinc-800 dark:bg-transparent"> <div className="flex min-h-[calc(theme(spacing.12)+1px)] flex-wrap items-start gap-x-4 border-b border-zinc-700 bg-zinc-800 px-4 dark:border-zinc-800 dark:bg-transparent">
@@ -163,16 +176,17 @@ function CodeGroupHeader({ title, children, selectedIndex }: IChildrenProps) {
)} )}
{hasTabs && ( {hasTabs && (
<TabList className="-mb-px flex gap-4 text-xs font-medium"> <TabList className="-mb-px flex gap-4 text-xs font-medium">
{Children.map(children, (child, childIndex) => ( {tabTitles!.map((tabTitle, tabIndex) => (
<Tab <Tab
key={tabIndex}
className={classNames( className={classNames(
'border-b py-3 transition focus:[&:not(:focus-visible)]:outline-none', 'border-b py-3 transition focus:[&:not(:focus-visible)]:outline-none',
childIndex === selectedIndex tabIndex === selectedIndex
? 'border-emerald-500 text-emerald-400' ? 'border-emerald-500 text-emerald-400'
: 'border-transparent text-zinc-400 hover:text-zinc-300', : 'border-transparent text-zinc-400 hover:text-zinc-300',
)} )}
> >
{getPanelTitle(child.props.children.props)} {tabTitle}
</Tab> </Tab>
))} ))}
</TabList> </TabList>
@@ -181,26 +195,25 @@ function CodeGroupHeader({ title, children, selectedIndex }: IChildrenProps) {
) )
} }
type ICodeGroupPanelsProps = { type ICodeGroupPanelsProps = PropsWithChildren<{
children: React.ReactNode targetCode?: CodeExample[]
[key: string]: any [key: string]: any
} }>
function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) {
const hasTabs = Children.count(children) > 1
if (hasTabs) { function CodeGroupPanels({ children, targetCode, ...props }: ICodeGroupPanelsProps) {
if ((targetCode?.length ?? 0) > 1) {
return ( return (
<TabPanels> <TabPanels>
{Children.map(children, child => ( {targetCode!.map(code => (
<TabPanel> <TabPanel>
<CodePanel {...props}>{child}</CodePanel> <CodePanel {...props} targetCode={code} />
</TabPanel> </TabPanel>
))} ))}
</TabPanels> </TabPanels>
) )
} }
return <CodePanel {...props} targetCode={targetCode}>{children}</CodePanel> return <CodePanel {...props} targetCode={targetCode?.[0]}>{children}</CodePanel>
} }
function usePreventLayoutShift() { function usePreventLayoutShift() {
@@ -231,10 +244,10 @@ function usePreventLayoutShift() {
function useTabGroupProps(availableLanguages: string[]) { function useTabGroupProps(availableLanguages: string[]) {
const [preferredLanguages, addPreferredLanguage] = useState<any>([]) const [preferredLanguages, addPreferredLanguage] = useState<any>([])
const [selectedIndex, setSelectedIndex] = useState(0) const [selectedIndex, setSelectedIndex] = useState(0)
const activeLanguage = [...availableLanguages].sort( const activeLanguage = [...(availableLanguages || [])].sort(
(a, z) => preferredLanguages.indexOf(z) - preferredLanguages.indexOf(a), (a, z) => preferredLanguages.indexOf(z) - preferredLanguages.indexOf(a),
)[0] )[0]
const languageIndex = availableLanguages.indexOf(activeLanguage) const languageIndex = availableLanguages?.indexOf(activeLanguage) || 0
const newSelectedIndex = languageIndex === -1 ? selectedIndex : languageIndex const newSelectedIndex = languageIndex === -1 ? selectedIndex : languageIndex
if (newSelectedIndex !== selectedIndex) if (newSelectedIndex !== selectedIndex)
setSelectedIndex(newSelectedIndex) setSelectedIndex(newSelectedIndex)
@@ -255,16 +268,26 @@ function useTabGroupProps(availableLanguages: string[]) {
const CodeGroupContext = createContext(false) const CodeGroupContext = createContext(false)
export function CodeGroup({ children, title, inputs, targetCode, ...props }: IChildrenProps) { type CodeGroupProps = PropsWithChildren<{
const languages = Children.map(children, child => /** Code example(s) to display */
getPanelTitle(child.props.children.props), targetCode?: string | CodeExample[]
) /** Example block title */
const tabGroupProps = useTabGroupProps(languages) title?: string
const hasTabs = Children.count(children) > 1 /** HTTP method tag, e.g. GET, POST */
const Container = hasTabs ? Tab.Group : 'div' tag?: string
/** API path */
label?: string
}>
export function CodeGroup({ children, title, targetCode, ...props }: CodeGroupProps) {
const examples = typeof targetCode === 'string' ? [{ code: targetCode }] as CodeExample[] : targetCode
const tabTitles = examples?.map(({ title }) => title || 'Code') || []
const tabGroupProps = useTabGroupProps(tabTitles)
const hasTabs = tabTitles.length > 1
const Container = hasTabs ? TabGroup : 'div'
const containerProps = hasTabs ? tabGroupProps : {} const containerProps = hasTabs ? tabGroupProps : {}
const headerProps = hasTabs const headerProps = hasTabs
? { selectedIndex: tabGroupProps.selectedIndex } ? { selectedIndex: tabGroupProps.selectedIndex, tabTitles }
: {} : {}
return ( return (
@@ -273,25 +296,19 @@ export function CodeGroup({ children, title, inputs, targetCode, ...props }: ICh
{...containerProps} {...containerProps}
className="not-prose my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10" className="not-prose my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10"
> >
<CodeGroupHeader title={title} {...headerProps}> <CodeGroupHeader title={title} {...headerProps} />
{children} <CodeGroupPanels {...props} targetCode={examples}>{children}</CodeGroupPanels>
</CodeGroupHeader>
<CodeGroupPanels {...props} targetCode={targetCode}>{children}</CodeGroupPanels>
</Container> </Container>
</CodeGroupContext.Provider> </CodeGroupContext.Provider>
) )
} }
type IChildProps = { type IChildProps = {
children: string children: ReactNode
[key: string]: any [key: string]: any
} }
export function Code({ children, ...props }: IChildProps) { export function Code({ children, ...props }: IChildProps) {
const isGrouped = useContext(CodeGroupContext)
if (isGrouped)
return <code {...props} dangerouslySetInnerHTML={{ __html: children }} />
return <code {...props}>{children}</code> return <code {...props}>{children}</code>
} }
@@ -303,3 +320,7 @@ export function Pre({ children, ...props }: IChildrenProps) {
return <CodeGroup {...props}>{children}</CodeGroup> return <CodeGroup {...props}>{children}</CodeGroup>
} }
export function Embed({ value, ...props }: IChildrenProps) {
return <span {...props}>{value}</span>
}

View File

@@ -7,10 +7,7 @@ The text generation application offers non-session support and is ideal for tran
<div> <div>
### Base URL ### Base URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### Authentication ### Authentication
@@ -19,12 +16,7 @@ The text generation application offers non-session support and is ideal for tran
For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below: For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -42,7 +34,7 @@ The text generation application offers non-session support and is ideal for tran
### Request Body ### Request Body
<Properties> <Properties>
<Property name='inputs' type='object' key='inputs'> <Property name='inputs' type='object' key='inputs'>
Allows the entry of various variable values defined by the App. Allows the entry of various variable values defined by the App.
The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable.
@@ -141,22 +133,19 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": {"query": "Hello, world!"},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/completion-messages' \ label="/completion-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": { --data-raw '{
"query": "Hello, world!" "inputs": {"query": "Hello, world!"},
}, "response_mode": "streaming",
"response_mode": "streaming", "user": "abc-123"
"user": "abc-123" }'`}
}' />
```
</CodeGroup>
### Blocking Mode ### Blocking Mode
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -248,15 +237,15 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### Response Example ### Response Example
@@ -286,7 +275,7 @@ The text generation application offers non-session support and is ideal for tran
<Row> <Row>
<Col> <Col>
Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API.
<i>Files can only be accessed if they belong to messages within the requesting application.</i> <i>Files can only be accessed if they belong to messages within the requesting application.</i>
### Path Parameters ### Path Parameters
@@ -314,25 +303,24 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Download as Attachment ### Download as Attachment
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download
```bash {{ title: 'cURL' }} Request"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ tag="GET"
--header 'Authorization: Bearer {api_key}' \ label="/files/:file_id/preview?as_attachment=true"
--output downloaded_file.png targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
``` --header 'Authorization: Bearer {api_key}' \\
--output downloaded_file.png`}
</CodeGroup> />
### Response Headers Example ### Response Headers Example
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -374,17 +362,16 @@ The text generation application offers non-session support and is ideal for tran
- `result` (string) Always returns "success" - `result` (string) Always returns "success"
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/completion-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/completion-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{ "user": "abc-123"}'`}
``` />
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -435,20 +422,19 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -490,15 +476,12 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
--header 'Content-Type: application/json' />
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -551,20 +534,19 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "Hello Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123" "text": "Hello Dify",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -595,12 +577,13 @@ The text generation application offers non-session support and is ideal for tran
- `author_name` (string) author name - `author_name` (string) author name
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -659,30 +642,30 @@ The text generation application offers non-session support and is ideal for tran
- `default` (string) Default value - `default` (string) Default value
- `options` (array[string]) Option values - `options` (array[string]) Option values
- `file_upload` (object) File upload configuration - `file_upload` (object) File upload configuration
- `document` (object) Document settings - `document` (object) Document settings
Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`. Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Document number limit, default is 3 - `number_limits` (int) Document number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `image` (object) Image settings - `image` (object) Image settings
Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Image number limit, default is 3 - `number_limits` (int) Image number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `audio` (object) Audio settings - `audio` (object) Audio settings
Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`. Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Audio number limit, default is 3 - `number_limits` (int) Audio number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `video` (object) Video settings - `video` (object) Video settings
Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`. Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Video number limit, default is 3 - `number_limits` (int) Video number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `custom` (object) Custom settings - `custom` (object) Custom settings
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Custom number limit, default is 3 - `number_limits` (int) Custom number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `system_parameters` (object) System parameters - `system_parameters` (object) System parameters
- `file_size_limit` (int) Document upload size limit (MB) - `file_size_limit` (int) Document upload size limit (MB)
- `image_file_size_limit` (int) Image file upload size limit (MB) - `image_file_size_limit` (int) Image file upload size limit (MB)
@@ -692,14 +675,12 @@ The text generation application offers non-session support and is ideal for tran
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -777,13 +758,13 @@ The text generation application offers non-session support and is ideal for tran
- `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon - `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<div> <div>
### ベース URL ### ベース URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="コード" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 認証 ### 認証
@@ -19,12 +16,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
すべての API リクエストで、以下のように `Authorization` HTTP ヘッダーに API キーを含めてください: すべての API リクエストで、以下のように `Authorization` HTTP ヘッダーに API キーを含めてください:
<CodeGroup title="Code"> <CodeGroup title="コード" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -42,7 +34,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
### リクエストボディ ### リクエストボディ
<Properties> <Properties>
<Property name='inputs' type='object' key='inputs'> <Property name='inputs' type='object' key='inputs'>
アプリで定義された各種変数値を入力できます。 アプリで定義された各種変数値を入力できます。
`inputs`パラメータには複数のキー/値ペアが含まれ、各キーは特定の変数に対応し、各値はその変数の具体的な値となります。 `inputs`パラメータには複数のキー/値ペアが含まれ、各キーは特定の変数に対応し、各値はその変数の具体的な値となります。
@@ -141,22 +133,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": {"query": "Hello, world!"},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/completion-messages' \ label="/completion-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": { --data-raw '{
"query": "Hello, world!" "inputs": {"query": "Hello, world!"},
}, "response_mode": "streaming",
"response_mode": "streaming", "user": "abc-123"
"user": "abc-123" }'`}
}' />
```
</CodeGroup>
### ブロッキングモード ### ブロッキングモード
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -247,15 +236,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### レスポンス例 ### レスポンス例
@@ -285,7 +274,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<Row> <Row>
<Col> <Col>
アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
<i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i> <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
### パスパラメータ ### パスパラメータ
@@ -313,25 +302,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 添付ファイルとしてダウンロード ### 添付ファイルとしてダウンロード
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### レスポンスヘッダー例 ### レスポンスヘッダー例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -373,17 +360,16 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `result` (string) 常に"success"を返します - `result` (string) 常に"success"を返します
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="POST" label="/completion-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/completion-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{ "user": "abc-123"}'`}
``` />
</CodeGroup>
### レスポンス例 ### レスポンス例
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -434,20 +420,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -488,15 +473,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
--header 'Content-Type: application/json' />
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -549,20 +531,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "Hello Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123" "text": "Hello Dify",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -593,12 +574,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `author_name` (string) 作者の名前 - `author_name` (string) 作者の名前
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -657,30 +639,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `default` (string) デフォルト値 - `default` (string) デフォルト値
- `options` (array[string]) オプション値 - `options` (array[string]) オプション値
- `file_upload` (object) ファイルアップロード設定 - `file_upload` (object) ファイルアップロード設定
- `document` (object) ドキュメント設定 - `document` (object) ドキュメント設定
現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ドキュメント数の上限。デフォルトは 3 - `number_limits` (int) ドキュメント数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `image` (object) 画像設定 - `image` (object) 画像設定
現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。 現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) 画像数の上限。デフォルトは 3 - `number_limits` (int) 画像数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `audio` (object) オーディオ設定 - `audio` (object) オーディオ設定
現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。 現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) オーディオ数の上限。デフォルトは 3 - `number_limits` (int) オーディオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `video` (object) ビデオ設定 - `video` (object) ビデオ設定
現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。 現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ビデオ数の上限。デフォルトは 3 - `number_limits` (int) ビデオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `custom` (object) カスタム設定 - `custom` (object) カスタム設定
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) カスタム数の上限。デフォルトは 3 - `number_limits` (int) カスタム数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `system_parameters` (object) システムパラメータ - `system_parameters` (object) システムパラメータ
- `file_size_limit` (int) ドキュメントアップロードサイズ制限MB - `file_size_limit` (int) ドキュメントアップロードサイズ制限MB
- `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB - `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB
@@ -690,14 +672,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -775,13 +755,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか - `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<div> <div>
### 基础 URL ### 基础 URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 鉴权 ### 鉴权
@@ -19,11 +16,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i> <i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i>
所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -142,21 +135,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": {"query": "Hello, world!"},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/completion-messages' \ label="/completion-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": { --data-raw '{
"query": "Hello, world!" "inputs": {"query": "Hello, world!"},
}, "response_mode": "streaming",
"response_mode": "streaming", "user": "abc-123"
"user": "abc-123" }'`}
}' />
```
</CodeGroup>
### blocking ### blocking
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -226,15 +217,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -262,7 +253,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Row> <Row>
<Col> <Col>
预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。
<i>文件只能在属于请求应用程序的消息范围内访问。</i> <i>文件只能在属于请求应用程序的消息范围内访问。</i>
### 路径参数 ### 路径参数
@@ -290,25 +281,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
### 请求示例 ### 请求示例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 作为附件下载 ### 作为附件下载
<CodeGroup title="下载请求" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="下载请求"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### 响应标头示例 ### 响应标头示例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -351,17 +340,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `result` (string) 固定返回 success - `result` (string) 固定返回 success
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/completion-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/completion-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{ "user": "abc-123"}'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -410,20 +397,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -464,15 +450,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
--header 'Content-Type: application/json' />
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -525,21 +508,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "你好Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "你好Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123", "text": "你好Dify",
"streaming": false "user": "abc-123"
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -569,12 +550,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- 'author_name' (string) 作者名称 - 'author_name' (string) 作者名称
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -632,30 +614,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `default` (string) 默认值 - `default` (string) 默认值
- `options` (array[string]) 选项值 - `options` (array[string]) 选项值
- `file_upload` (object) 文件上传配置 - `file_upload` (object) 文件上传配置
- `document` (object) 文档设置 - `document` (object) 文档设置
当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 文档数量限制,默认为 3 - `number_limits` (int) 文档数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `image` (object) 图片设置 - `image` (object) 图片设置
当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 图片数量限制,默认为 3 - `number_limits` (int) 图片数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `audio` (object) 音频设置 - `audio` (object) 音频设置
当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 音频数量限制,默认为 3 - `number_limits` (int) 音频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `video` (object) 视频设置 - `video` (object) 视频设置
当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 视频数量限制,默认为 3 - `number_limits` (int) 视频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `custom` (object) 自定义设置 - `custom` (object) 自定义设置
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 自定义数量限制,默认为 3 - `number_limits` (int) 自定义数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `system_parameters` (object) 系统参数 - `system_parameters` (object) 系统参数
- `file_size_limit` (int) 文档上传大小限制 (MB) - `file_size_limit` (int) 文档上传大小限制 (MB)
- `image_file_size_limit` (int) 图片文件上传大小限制MB - `image_file_size_limit` (int) 图片文件上传大小限制MB
@@ -664,14 +646,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -740,13 +721,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖 - `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -849,18 +830,11 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \ --data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"question": "What is your name?",
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -903,18 +877,11 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ --data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"question": "What is your name?",
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -951,7 +918,9 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\
--header 'Authorization: Bearer {api_key}' \\
--header 'Content-Type: application/json'`}
> >
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \
@@ -999,19 +968,11 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotation-reply/{action}" label="/apps/annotation-reply/{action}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotation-reply/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`} targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotation-reply/{action}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST 'https://api.dify.ai/v1/apps/annotation-reply/{action}' \ --data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"score_threshold": 0.9,
"embedding_provider_name": "zhipu",
"embedding_model_name": "embedding_3"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1020,7 +981,7 @@ ___
"job_status": "waiting" "job_status": "waiting"
} }
``` ```
</CodeGroup> </CodeGroup>
</Col> </Col>
</Row> </Row>
@@ -1049,13 +1010,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -1,4 +1,4 @@
import { CodeGroup } from '../code.tsx' import { CodeGroup, Embed } from '../code.tsx'
import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
# Advanced Chat App API # Advanced Chat App API
@@ -7,10 +7,7 @@ Chat applications support session persistence, allowing previous chat history to
<div> <div>
### Base URL ### Base URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### Authentication ### Authentication
@@ -19,12 +16,7 @@ Chat applications support session persistence, allowing previous chat history to
For all API requests, include your API Key in the `Authorization`HTTP Header, as shown below: For all API requests, include your API Key in the `Authorization`HTTP Header, as shown below:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -66,7 +58,7 @@ Chat applications support session persistence, allowing previous chat history to
</Property> </Property>
<Property name='files' type='array[object]' key='files'> <Property name='files' type='array[object]' key='files'>
File list, suitable for inputting files combined with text understanding and answering questions, available only when the model supports Vision capability. File list, suitable for inputting files combined with text understanding and answering questions, available only when the model supports Vision capability.
- `type` (string) Supported type: - `type` (string) Supported type:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR') - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
@@ -237,27 +229,34 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"query": "eh", "inputs": ${JSON.stringify(props.inputs)},
"response_mode": "streaming", "query": "What are the specs of the iPhone 13 Pro Max?",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "response_mode": "streaming",
"user": "abc-123" "conversation_id": "",
}' "user": "abc-123",
``` "files": [
</CodeGroup> {
"type": "image",
"transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png"
}
]
}'`}
/>
### Blocking Mode ### Blocking Mode
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -363,16 +362,15 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -401,7 +399,7 @@ Chat applications support session persistence, allowing previous chat history to
<Row> <Row>
<Col> <Col>
Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API.
<i>Files can only be accessed if they belong to messages within the requesting application.</i> <i>Files can only be accessed if they belong to messages within the requesting application.</i>
### Path Parameters ### Path Parameters
@@ -429,25 +427,23 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Download as Attachment ### Download as Attachment
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### Response Headers Example ### Response Headers Example
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -479,27 +475,28 @@ Chat applications support session persistence, allowing previous chat history to
/> />
<Row> <Row>
<Col> <Col>
Only supported in streaming mode. Only supported in streaming mode.
### Path ### Path
- `task_id` (string) Task ID, can be obtained from the streaming chunk return - `task_id` (string) Task ID, can be obtained from the streaming chunk return
### Request Body ### Request Body
- `user` (string) Required - `user` (string) Required
User identifier, used to define the identity of the end-user, must be consistent with the user passed in the message sending interface. The Service API does not share conversations created by the WebApp. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the message sending interface. The Service API does not share conversations created by the WebApp.
### Response ### Response
- `result` (string) Always returns "success" - `result` (string) Always returns "success"
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{
``` "user": "abc-123"
</CodeGroup> }'`}
/>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -550,20 +547,19 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -605,15 +601,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \\
--header 'Content-Type: application/json' --header 'Authorization: Bearer {api_key}' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -668,15 +663,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -745,14 +739,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
tag="GET"
label="/messages"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id={conversation_id}'
--header 'Authorization: Bearer {api_key}'`}
/>
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -838,14 +832,13 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \ label="/conversations"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -903,19 +896,18 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\
--header 'Accept: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Accept: application/json' \\
--data '{ --header 'Authorization: Bearer {api_key}' \\
"user": "abc-123" --data '{
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -963,20 +955,19 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1047,21 +1038,20 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
tag="GET"
label="/conversations/:conversation_id/variables"
debug="true"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
--header 'Authorization: Bearer {api_key}'`} />
```bash {{ title: 'cURL' }} <CodeGroup
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ title="Request with variable name filter"
--header 'Authorization: Bearer {api_key}' language="bash"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \\
--header 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1147,51 +1137,52 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
tag="PUT"
label="/conversations/:conversation_id/variables/:variable_id"
targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \\
--data-raw '{
"value": "Updated Value",
"user": "abc-123"
}'`}
/>
```bash {{ title: 'cURL' }} <CodeGroup
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ title="Update with different value types"
--header 'Content-Type: application/json' \ targetCode={[
--header 'Authorization: Bearer {api_key}' \ {
--data-raw '{ title: 'String',
"value": "Updated Value", code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
"user": "abc-123" --header 'Content-Type: application/json' \\
}' --header 'Authorization: Bearer {api_key}' \\
``` --data-raw '{
"value": "New string value",
</CodeGroup> "user": "abc-123"
}'`,
<CodeGroup title="Update with different value types"> }, {
```bash {{ title: 'String Value' }} title: 'Number',
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --data-raw '{
"value": "New string value", "value": 42,
"user": "abc-123" "user": "abc-123"
}' }'`,
``` }, {
title: 'Object',
```bash {{ title: 'Number Value' }} code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ --header 'Content-Type: application/json' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --data-raw '{
--data-raw '{ "value": {"product": "Widget", "quantity": 10, "price": 29.99},
"value": 42, "user": "abc-123"
"user": "abc-123" }'`,
}' },
``` ]}
/>
```bash {{ title: 'Object Value' }}
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"value": {"product": "Widget", "quantity": 10, "price": 29.99},
"user": "abc-123"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1240,15 +1231,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1288,20 +1278,19 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "Hello Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123", "text": "Hello Dify",
"streaming": false "user": "abc-123",
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -1332,12 +1321,14 @@ Chat applications support session persistence, allowing previous chat history to
- `author_name` (string) application author name - `author_name` (string) application author name
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1403,30 +1394,30 @@ Chat applications support session persistence, allowing previous chat history to
- `default` (string) Default value - `default` (string) Default value
- `options` (array[string]) Option values - `options` (array[string]) Option values
- `file_upload` (object) File upload configuration - `file_upload` (object) File upload configuration
- `document` (object) Document settings - `document` (object) Document settings
Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`. Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Document number limit, default is 3 - `number_limits` (int) Document number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `image` (object) Image settings - `image` (object) Image settings
Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Image number limit, default is 3 - `number_limits` (int) Image number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `audio` (object) Audio settings - `audio` (object) Audio settings
Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`. Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Audio number limit, default is 3 - `number_limits` (int) Audio number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `video` (object) Video settings - `video` (object) Video settings
Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`. Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Video number limit, default is 3 - `number_limits` (int) Video number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `custom` (object) Custom settings - `custom` (object) Custom settings
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Custom number limit, default is 3 - `number_limits` (int) Custom number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `system_parameters` (object) System parameters - `system_parameters` (object) System parameters
- `file_size_limit` (int) Document upload size limit (MB) - `file_size_limit` (int) Document upload size limit (MB)
- `image_file_size_limit` (int) Image file upload size limit (MB) - `image_file_size_limit` (int) Image file upload size limit (MB)
@@ -1436,14 +1427,12 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1521,13 +1510,13 @@ Chat applications support session persistence, allowing previous chat history to
- (string) url of icon - (string) url of icon
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/meta' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1572,13 +1561,13 @@ Chat applications support session persistence, allowing previous chat history to
- `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon - `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/site"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1627,13 +1616,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotations?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotations?page=1&limit=20' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.apiBaseUrl}/apps/annotations?page=1&limit=20' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1681,18 +1666,14 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "question": "What is your name?",
--header 'Content-Type: application/json' \ "answer": "I am Dify."
--data-raw '{ }'`}
"question": "What is your name?", />
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1735,18 +1716,14 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "question": "What is your name?",
--header 'Content-Type: application/json' \ "answer": "I am Dify."
--data-raw '{ }'`}
"question": "What is your name?", />
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1781,15 +1758,12 @@ ___
<Col sticky> <Col sticky>
<CodeGroup <CodeGroup
title="Request" title="Request"
tag="PUT" tag="DELETE"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json'`}
curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ />
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -1830,19 +1804,15 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotation-reply/{action}" label="/apps/annotation-reply/{action}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotation-reply/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`} targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotation-reply/{action}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST 'https://api.dify.ai/v1/apps/annotation-reply/{action}' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "score_threshold": 0.9,
--header 'Content-Type: application/json' \ "embedding_provider_name": "zhipu",
--data-raw '{ "embedding_model_name": "embedding_3"
"score_threshold": 0.9, }'`}
"embedding_provider_name": "zhipu", />
"embedding_model_name": "embedding_3"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1880,13 +1850,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotation-reply/{action}/status/{job_id}' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<div> <div>
### ベース URL ### ベース URL
<CodeGroup title="コード" targetCode={props.appDetail.api_base_url}> <CodeGroup title="コード" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 認証 ### 認証
@@ -19,12 +16,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
すべての API リクエストには、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください: すべての API リクエストには、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください:
<CodeGroup title="コード"> <CodeGroup title="コード" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -66,7 +58,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Property> </Property>
<Property name='files' type='array[object]' key='files'> <Property name='files' type='array[object]' key='files'>
ファイルリスト、テキストの理解と質問への回答を組み合わせたファイルの入力に適しており、モデルがビジョン機能をサポートしている場合にのみ利用可能です。 ファイルリスト、テキストの理解と質問への回答を組み合わせたファイルの入力に適しており、モデルがビジョン機能をサポートしている場合にのみ利用可能です。
- `type` (string) サポートされているタイプ: - `type` (string) サポートされているタイプ:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR') - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
@@ -237,27 +229,34 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "iPhone 13 Pro Maxの仕様は何ですか",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"query": "eh", "inputs": ${JSON.stringify(props.inputs)},
"response_mode": "streaming", "query": "What are the specs of the iPhone 13 Pro Max?",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "response_mode": "streaming",
"user": "abc-123" "conversation_id": "",
}' "user": "abc-123",
``` "files": [
</CodeGroup> {
"type": "image",
"transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png"
}
]
}'`}
/>
### ブロッキングモード ### ブロッキングモード
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -363,16 +362,16 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}>
```bash {{ title: 'cURL' }}
curl -X POST '${props.appDetail.api_base_url}/files/upload' \
--header 'Authorization: Bearer {api_key}' \
--form 'file=@"/path/to/file"'
```
</CodeGroup>
<CodeGroup
title="リクエスト"
tag="POST"
label="/files/upload"
targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--header 'Authorization: Bearer {api_key}' \\
--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
/>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
@@ -401,7 +400,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<Row> <Row>
<Col> <Col>
アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
<i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i> <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
### パスパラメータ ### パスパラメータ
@@ -429,25 +428,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL - ブラウザプレビュー' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 添付ファイルとしてダウンロード ### 添付ファイルとしてダウンロード
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="ダウンロードリクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### レスポンスヘッダー例 ### レスポンスヘッダー例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -491,17 +488,17 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{
``` "user": "abc-123"
</CodeGroup> }'`}
/>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -551,20 +548,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -606,15 +602,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \\
--header 'Content-Type: application/json' --header 'Authorization: Bearer {api_key}' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -670,15 +665,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -747,14 +741,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' label="/messages"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id={conversation_id}'
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -839,14 +832,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \ label="/conversations"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -904,19 +896,18 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\
--header 'Accept: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Accept: application/json' \\
--data '{ --header 'Authorization: Bearer {api_key}' \\
"user": "abc-123" --data '{
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```text {{ title: '応答' }} ```text {{ title: '応答' }}
@@ -964,20 +955,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1048,21 +1038,20 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
tag="GET"
label="/conversations/:conversation_id/variables"
debug="true"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
--header 'Authorization: Bearer {api_key}'`} />
```bash {{ title: 'cURL' }} <CodeGroup
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ title="変数名フィルター付きリクエスト"
--header 'Authorization: Bearer {api_key}' language="bash"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \\
--header 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1148,51 +1137,52 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
tag="PUT"
label="/conversations/:conversation_id/variables/:variable_id"
targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \\
--data-raw '{
"value": "Updated Value",
"user": "abc-123"
}'`}
/>
```bash {{ title: 'cURL' }} <CodeGroup
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ title="異なる値型での更新"
--header 'Content-Type: application/json' \ targetCode={[
--header 'Authorization: Bearer {api_key}' \ {
--data-raw '{ title: '文字列値',
"value": "Updated Value", code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
"user": "abc-123" --header 'Content-Type: application/json' \\
}' --header 'Authorization: Bearer {api_key}' \\
``` --data-raw '{
"value": "新しい文字列値",
</CodeGroup> "user": "abc-123"
}'`,
<CodeGroup title="異なる値型での更新"> }, {
```bash {{ title: '文字列値' }} title: '数値',
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --data-raw '{
"value": "新しい文字列値", "value": 42,
"user": "abc-123" "user": "abc-123"
}' }'`,
``` }, {
title: 'オブジェクト値',
```bash {{ title: '数値' }} code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ --header 'Content-Type: application/json' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --data-raw '{
--data-raw '{ "value": {"product": "Widget", "quantity": 10, "price": 29.99},
"value": 42, "user": "abc-123"
"user": "abc-123" }'`,
}' },
``` ]}
/>
```bash {{ title: 'オブジェクト値' }}
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"value": {"product": "Widget", "quantity": 10, "price": 29.99},
"user": "abc-123"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1241,15 +1231,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1289,20 +1278,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "Hello Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123", "text": "Hello Dify",
"streaming": false "user": "abc-123",
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="ヘッダー"> <CodeGroup title="ヘッダー">
```json {{ title: 'ヘッダー' }} ```json {{ title: 'ヘッダー' }}
@@ -1333,12 +1321,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `author_name` (string) 作者の名前 - `author_name` (string) 作者の名前
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1404,30 +1394,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `default` (string) デフォルト値 - `default` (string) デフォルト値
- `options` (array[string]) オプション値 - `options` (array[string]) オプション値
- `file_upload` (object) ファイルアップロード設定 - `file_upload` (object) ファイルアップロード設定
- `document` (object) ドキュメント設定 - `document` (object) ドキュメント設定
現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ドキュメント数の上限。デフォルトは 3 - `number_limits` (int) ドキュメント数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `image` (object) 画像設定 - `image` (object) 画像設定
現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。 現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) 画像数の上限。デフォルトは 3 - `number_limits` (int) 画像数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `audio` (object) オーディオ設定 - `audio` (object) オーディオ設定
現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。 現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) オーディオ数の上限。デフォルトは 3 - `number_limits` (int) オーディオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `video` (object) ビデオ設定 - `video` (object) ビデオ設定
現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。 現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ビデオ数の上限。デフォルトは 3 - `number_limits` (int) ビデオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `custom` (object) カスタム設定 - `custom` (object) カスタム設定
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) カスタム数の上限。デフォルトは 3 - `number_limits` (int) カスタム数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `system_parameters` (object) システムパラメータ - `system_parameters` (object) システムパラメータ
- `file_size_limit` (int) ドキュメントアップロードサイズ制限MB - `file_size_limit` (int) ドキュメントアップロードサイズ制限MB
- `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB - `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB
@@ -1437,14 +1427,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1522,13 +1510,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- (string) アイコンの URL - (string) アイコンの URL
</Col> </Col>
<Col> <Col>
<CodeGroup title="リクエスト" tag="GET" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}>
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/meta' \
-H 'Authorization: Bearer {api_key}'
```
</CodeGroup> <CodeGroup
title="リクエスト"
tag="GET"
label="/meta"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1574,13 +1563,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか - `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/site"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<div> <div>
### 基础 URL ### 基础 URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 鉴权 ### 鉴权
@@ -18,11 +15,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i> <i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i>
所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -237,37 +230,34 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
-H 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
-H 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": { --data-raw '{
"name": "dify" "inputs": ${JSON.stringify(props.inputs)},
}, "query": "What are the specs of the iPhone 13 Pro Max?",
"query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "streaming",
"conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "conversation_id": "",
"response_mode": "streaming", "user": "abc-123",
"user": "abc-123", "files": [
"files": [ {
{
"type": "image", "type": "image",
"transfer_method": "remote_url", "transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png" "url": "https://cloud.dify.ai/logo/logo-site.png"
} }
] ]
}' }'`}
``` />
</CodeGroup>
### 阻塞模式 ### 阻塞模式
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -373,15 +363,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -409,7 +399,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Row> <Row>
<Col> <Col>
预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。
<i>文件只能在属于请求应用程序的消息范围内访问。</i> <i>文件只能在属于请求应用程序的消息范围内访问。</i>
### 路径参数 ### 路径参数
@@ -437,25 +427,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
### 请求示例 ### 请求示例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 作为附件下载 ### 作为附件下载
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### 响应标头示例 ### 响应标头示例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -498,17 +486,17 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `result` (string) 固定返回 success - `result` (string) 固定返回 success
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{
``` "user": "abc-123"
}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -557,20 +545,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -612,15 +599,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \\
--header 'Content-Type: application/json' --header 'Authorization: Bearer {api_key}' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -676,15 +662,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -753,14 +738,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' label="/messages"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id={conversation_id}'
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -876,14 +860,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \ label="/conversations"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -940,19 +923,18 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\
--header 'Accept: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Accept: application/json' \\
--data '{ --header 'Authorization: Bearer {api_key}' \\
"user": "abc-123" --data '{
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -1002,20 +984,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \\
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1086,21 +1067,20 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
tag="GET"
label="/conversations/:conversation_id/variables"
debug="true"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
--header 'Authorization: Bearer {api_key}'`} />
```bash {{ title: 'cURL' }} <CodeGroup
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ title="带变量名过滤的请求"
--header 'Authorization: Bearer {api_key}' language="bash"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \\
--header 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1186,51 +1166,52 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
tag="PUT"
label="/conversations/:conversation_id/variables/:variable_id"
targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \\
--data-raw '{
"value": "Updated Value",
"user": "abc-123"
}'`}
/>
```bash {{ title: 'cURL' }} <CodeGroup
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ title="使用不同值类型更新"
--header 'Content-Type: application/json' \ targetCode={[
--header 'Authorization: Bearer {api_key}' \ {
--data-raw '{ title: '字符串值',
"value": "Updated Value", code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
"user": "abc-123" --header 'Content-Type: application/json' \\
}' --header 'Authorization: Bearer {api_key}' \\
``` --data-raw '{
"value": "新的字符串值",
</CodeGroup> "user": "abc-123"
}'`,
<CodeGroup title="使用不同值类型更新"> }, {
```bash {{ title: '字符串值' }} title: '数字值',
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --data-raw '{
"value": "新的字符串值", "value": 42,
"user": "abc-123" "user": "abc-123"
}' }'`,
``` }, {
title: '对象值',
```bash {{ title: '数字值' }} code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ --header 'Content-Type: application/json' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --data-raw '{
--data-raw '{ "value": {"product": "Widget", "quantity": 10, "price": 29.99},
"value": 42, "user": "abc-123"
"user": "abc-123" }'`,
}' },
``` ]}
/>
```bash {{ title: '对象值' }}
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"value": {"product": "Widget", "quantity": 10, "price": 29.99},
"user": "abc-123"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1276,15 +1257,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1324,20 +1304,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "你好Dify",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", --data-raw '{
"text": "你好Dify", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
"user": "abc-123" "text": "Hello Dify",
}' "user": "abc-123",
``` }'`}
/>
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -1365,12 +1344,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `tags` (array[string]) 应用标签 - `tags` (array[string]) 应用标签
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1436,30 +1416,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `default` (string) 默认值 - `default` (string) 默认值
- `options` (array[string]) 选项值 - `options` (array[string]) 选项值
- `file_upload` (object) 文件上传配置 - `file_upload` (object) 文件上传配置
- `document` (object) 文档设置 - `document` (object) 文档设置
当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 文档数量限制,默认为 3 - `number_limits` (int) 文档数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `image` (object) 图片设置 - `image` (object) 图片设置
当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 图片数量限制,默认为 3 - `number_limits` (int) 图片数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `audio` (object) 音频设置 - `audio` (object) 音频设置
当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 音频数量限制,默认为 3 - `number_limits` (int) 音频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `video` (object) 视频设置 - `video` (object) 视频设置
当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 视频数量限制,默认为 3 - `number_limits` (int) 视频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `custom` (object) 自定义设置 - `custom` (object) 自定义设置
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 自定义数量限制,默认为 3 - `number_limits` (int) 自定义数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `system_parameters` (object) 系统参数 - `system_parameters` (object) 系统参数
- `file_size_limit` (int) Document upload size limit (MB) - `file_size_limit` (int) Document upload size limit (MB)
- `image_file_size_limit` (int) Image file upload size limit (MB) - `image_file_size_limit` (int) Image file upload size limit (MB)
@@ -1468,14 +1448,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1538,13 +1516,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- (string) 图标 URL - (string) 图标 URL
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/meta' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1589,13 +1567,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖 - `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/site"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1644,13 +1622,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotations?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotations?page=1&limit=20' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.appDetail.api_base_url}/apps/annotations?page=1&limit=20' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1698,18 +1672,14 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "question": "What is your name?",
--header 'Content-Type: application/json' \ "answer": "I am Dify."
--data-raw '{ }'`}
"question": "What is your name?", />
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1752,18 +1722,14 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "question": "What is your name?",
--header 'Content-Type: application/json' \ "answer": "I am Dify."
--data-raw '{ }'`}
"question": "What is your name?", />
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1798,15 +1764,12 @@ ___
<Col sticky> <Col sticky>
<CodeGroup <CodeGroup
title="Request" title="Request"
tag="PUT" tag="DELETE"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json'`}
curl --location --request DELETE '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \ />
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -1847,19 +1810,15 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotation-reply/{action}" label="/apps/annotation-reply/{action}"
targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotation-reply/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`} targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotation-reply/{action}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST 'https://api.dify.ai/v1/apps/annotation-reply/{action}' \ --data-raw '{
--header 'Authorization: Bearer {api_key}' \ "score_threshold": 0.9,
--header 'Content-Type: application/json' \ "embedding_provider_name": "zhipu",
--data-raw '{ "embedding_model_name": "embedding_3"
"score_threshold": 0.9, }'`}
"embedding_provider_name": "zhipu", />
"embedding_model_name": "embedding_3"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1897,13 +1856,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotation-reply/{action}/status/{job_id}' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/apps/annotation-reply/{action}/status/{job_id}' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.appDetail.api_base_url}/apps/annotation-reply/{action}/status/{job_id}' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ Chat applications support session persistence, allowing previous chat history to
<div> <div>
### Base URL ### Base URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### Authentication ### Authentication
@@ -19,12 +16,7 @@ Chat applications support session persistence, allowing previous chat history to
For all API requests, include your API Key in the `Authorization`HTTP Header, as shown below: For all API requests, include your API Key in the `Authorization`HTTP Header, as shown below:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -192,27 +184,34 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"query": "eh", "inputs": ${JSON.stringify(props.inputs)},
"response_mode": "streaming", "query": "What are the specs of the iPhone 13 Pro Max?",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "response_mode": "streaming",
"user": "abc-123" "conversation_id": "",
}' "user": "abc-123",
``` "files": [
</CodeGroup> {
"type": "image",
"transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png"
}
]
}'`}
/>
### Blocking Mode ### Blocking Mode
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -327,16 +326,15 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -365,7 +363,7 @@ Chat applications support session persistence, allowing previous chat history to
<Row> <Row>
<Col> <Col>
Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API.
<i>Files can only be accessed if they belong to messages within the requesting application.</i> <i>Files can only be accessed if they belong to messages within the requesting application.</i>
### Path Parameters ### Path Parameters
@@ -393,25 +391,23 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Download as Attachment ### Download as Attachment
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### Response Headers Example ### Response Headers Example
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -453,17 +449,16 @@ Chat applications support session persistence, allowing previous chat history to
- `result` (string) Always returns "success" - `result` (string) Always returns "success"
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{"user": "abc-123"}'`}
``` />
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -514,20 +509,19 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -569,15 +563,12 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
--header 'Content-Type: application/json' />
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -632,15 +623,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -720,14 +710,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
tag="GET"
label="/messages"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\
--header 'Authorization: Bearer {api_key}'`}
/>
```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
### Response Example (Basic Assistant) ### Response Example (Basic Assistant)
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -872,14 +862,13 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \ label="/conversations"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -937,19 +926,17 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\
--header 'Accept: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \\
--data '{ --data-raw '{
"user": "abc-123" "user": "abc-123"
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -997,20 +984,19 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1081,14 +1067,13 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ label="/conversations/:conversation_id/variables"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Request with variable name filter"> <CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
@@ -1181,19 +1166,18 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="PUT"
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ label="/conversations/:conversation_id/variables/:variable_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"value": "Updated Value", --data-raw '{
"user": "abc-123" "value": "Updated Value",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Update with different value types"> <CodeGroup title="Update with different value types">
```bash {{ title: 'String Value' }} ```bash {{ title: 'String Value' }}
@@ -1274,15 +1258,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1322,15 +1305,14 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'text=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\
--form 'file=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --form 'text=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}
/>
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -1361,12 +1343,13 @@ Chat applications support session persistence, allowing previous chat history to
- `author_name` (string) application author name - `author_name` (string) application author name
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1440,30 +1423,30 @@ Chat applications support session persistence, allowing previous chat history to
- `default` (string) Default value - `default` (string) Default value
- `options` (array[string]) Option values - `options` (array[string]) Option values
- `file_upload` (object) File upload configuration - `file_upload` (object) File upload configuration
- `document` (object) Document settings - `document` (object) Document settings
Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`. Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Document number limit, default is 3 - `number_limits` (int) Document number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `image` (object) Image settings - `image` (object) Image settings
Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Image number limit, default is 3 - `number_limits` (int) Image number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `audio` (object) Audio settings - `audio` (object) Audio settings
Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`. Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Audio number limit, default is 3 - `number_limits` (int) Audio number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `video` (object) Video settings - `video` (object) Video settings
Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`. Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Video number limit, default is 3 - `number_limits` (int) Video number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `custom` (object) Custom settings - `custom` (object) Custom settings
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Custom number limit, default is 3 - `number_limits` (int) Custom number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `system_parameters` (object) System parameters - `system_parameters` (object) System parameters
- `file_size_limit` (int) Document upload size limit (MB) - `file_size_limit` (int) Document upload size limit (MB)
- `image_file_size_limit` (int) Image file upload size limit (MB) - `image_file_size_limit` (int) Image file upload size limit (MB)
@@ -1473,14 +1456,12 @@ Chat applications support session persistence, allowing previous chat history to
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1558,13 +1539,13 @@ Chat applications support session persistence, allowing previous chat history to
- (string) url of icon - (string) url of icon
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/meta' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1609,13 +1590,13 @@ Chat applications support session persistence, allowing previous chat history to
- `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon - `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1664,13 +1645,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotations?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotations?page=1&limit=20' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.apiBaseUrl}/apps/annotations?page=1&limit=20' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1718,18 +1695,11 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST '${props.apiBaseUrl}/apps/annotations' \ --data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"question": "What is your name?",
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1774,18 +1744,11 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ --data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"question": "What is your name?",
"answer": "I am Dify."
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1824,13 +1787,10 @@ ___
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`} targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json'`}
curl --location --request DELETE '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ />
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -1871,19 +1831,11 @@ ___
title="Request" title="Request"
tag="POST" tag="POST"
label="/apps/annotation-reply/{action}" label="/apps/annotation-reply/{action}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotation-reply/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`} targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotation-reply/{action}' \\
> --header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --header 'Content-Type: application/json' \\
curl --location --request POST 'https://api.dify.ai/v1/apps/annotation-reply/{action}' \ --data-raw '{"score_threshold": 0.9, "embedding_provider_name": "zhipu", "embedding_model_name": "embedding_3"}'`}
--header 'Authorization: Bearer {api_key}' \ />
--header 'Content-Type: application/json' \
--data-raw '{
"score_threshold": 0.9,
"embedding_provider_name": "zhipu",
"embedding_model_name": "embedding_3"
}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1912,7 +1864,7 @@ ___
Action, can only be 'enable' or 'disable', must be the same as the action in the initial annotation reply settings interface Action, can only be 'enable' or 'disable', must be the same as the action in the initial annotation reply settings interface
</Property> </Property>
<Property name='job_id' type='string' key='job_id'> <Property name='job_id' type='string' key='job_id'>
Job ID, Job ID,
</Property> </Property>
</Properties> </Properties>
</Col> </Col>
@@ -1921,13 +1873,9 @@ ___
title="Request" title="Request"
tag="GET" tag="GET"
label="/apps/annotations" label="/apps/annotations"
targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \\\n--header 'Authorization: Bearer {api_key}'`} targetCode={`curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \\
> --header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl --location --request GET '${props.apiBaseUrl}/apps/annotation-reply/{action}/status/{job_id}' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<div> <div>
### ベース URL ### ベース URL
<CodeGroup title="コード" targetCode={props.appDetail.api_base_url}> <CodeGroup title="コード" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 認証 ### 認証
@@ -19,12 +16,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
すべての API リクエストにおいて、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください: すべての API リクエストにおいて、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください:
<CodeGroup title="コード"> <CodeGroup title="コード" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -192,27 +184,34 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"query": "eh", "inputs": ${JSON.stringify(props.inputs)},
"response_mode": "streaming", "query": "What are the specs of the iPhone 13 Pro Max?",
"conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276", "response_mode": "streaming",
"user": "abc-123" "conversation_id": "",
}' "user": "abc-123",
``` "files": [
</CodeGroup> {
"type": "image",
"transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png"
}
]
}'`}
/>
### ブロッキングモード ### ブロッキングモード
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -327,16 +326,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
@@ -365,7 +363,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<Row> <Row>
<Col> <Col>
アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
<i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i> <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
### パスパラメータ ### パスパラメータ
@@ -393,25 +391,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 添付ファイルとしてダウンロード ### 添付ファイルとしてダウンロード
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### レスポンスヘッダー例 ### レスポンスヘッダー例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -453,17 +449,16 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `result` (string) 常に"success"を返します - `result` (string) 常に"success"を返します
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{"user": "abc-123"}'`}
``` />
</CodeGroup>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
@@ -514,20 +509,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -569,17 +563,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="リクエスト"
tag="GET"
label="/app/feedbacks"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
/>
```bash {{ title: 'cURL' }} <CodeGroup title="応答">
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json'
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"data": [ "data": [
@@ -633,15 +624,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -721,14 +711,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' label="/messages"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 応答例(基本アシスタント) ### 応答例(基本アシスタント)
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -872,14 +861,9 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup title="リクエスト" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
--header 'Authorization: Bearer {api_key}'`}
```bash {{ title: 'cURL' }} />
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
--header 'Authorization: Bearer {api_key}'
```
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -937,19 +921,17 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\
--header 'Accept: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \\
--data '{ --data-raw '{
"user": "abc-123" "user": "abc-123"
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```text {{ title: '応答' }} ```text {{ title: '応答' }}
@@ -997,20 +979,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1080,14 +1061,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ label="/conversations/:conversation_id/variables"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Request with variable name filter"> <CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
@@ -1096,7 +1076,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
``` ```
</CodeGroup> </CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="応答">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"limit": 100, "limit": 100,
@@ -1180,19 +1160,18 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="PUT"
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ label="/conversations/:conversation_id/variables/:variable_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"value": "Updated Value", --data-raw '{
"user": "abc-123" "value": "Updated Value",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="異なる値型での更新"> <CodeGroup title="異なる値型での更新">
```bash {{ title: '文字列値' }} ```bash {{ title: '文字列値' }}
@@ -1226,7 +1205,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
``` ```
</CodeGroup> </CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="応答">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"id": "variable-uuid-1", "id": "variable-uuid-1",
@@ -1273,15 +1252,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
/>
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1321,15 +1299,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/text-to-audio" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'text=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\
--form 'file=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --form 'text=Hello Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}
/>
</CodeGroup>
<CodeGroup title="ヘッダー"> <CodeGroup title="ヘッダー">
```json {{ title: 'ヘッダー' }} ```json {{ title: 'ヘッダー' }}
@@ -1360,13 +1337,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `author_name` (string) 作者の名前 - `author_name` (string) 作者の名前
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
<CodeGroup title="Response"> />
<CodeGroup title="応答">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"name": "My App", "name": "My App",
@@ -1431,30 +1409,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `default` (string) デフォルト値 - `default` (string) デフォルト値
- `options` (array[string]) オプション値 - `options` (array[string]) オプション値
- `file_upload` (object) ファイルアップロード設定 - `file_upload` (object) ファイルアップロード設定
- `document` (object) ドキュメント設定 - `document` (object) ドキュメント設定
現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ドキュメント数の上限。デフォルトは 3 - `number_limits` (int) ドキュメント数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `image` (object) 画像設定 - `image` (object) 画像設定
現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。 現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) 画像数の上限。デフォルトは 3 - `number_limits` (int) 画像数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `audio` (object) オーディオ設定 - `audio` (object) オーディオ設定
現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。 現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) オーディオ数の上限。デフォルトは 3 - `number_limits` (int) オーディオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `video` (object) ビデオ設定 - `video` (object) ビデオ設定
現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。 現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ビデオ数の上限。デフォルトは 3 - `number_limits` (int) ビデオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `custom` (object) カスタム設定 - `custom` (object) カスタム設定
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) カスタム数の上限。デフォルトは 3 - `number_limits` (int) カスタム数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `system_parameters` (object) システムパラメータ - `system_parameters` (object) システムパラメータ
- `file_size_limit` (int) ドキュメントアップロードサイズ制限MB - `file_size_limit` (int) ドキュメントアップロードサイズ制限MB
- `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB - `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB
@@ -1464,14 +1442,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1549,13 +1525,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- (string) アイコンの URL - (string) アイコンの URL
</Col> </Col>
<Col> <Col>
<CodeGroup title="リクエスト" tag="GET" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/meta' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1601,15 +1577,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか - `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup> <CodeGroup title="応答">
<CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"title": "My App", "title": "My App",

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<div> <div>
### 基础 URL ### 基础 URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 鉴权 ### 鉴权
@@ -18,11 +15,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i> <i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i>
所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -194,37 +187,34 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/chat-messages' \ label="/chat-messages"
-H 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
-H 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": { --data-raw '{
"name": "dify" "inputs": ${JSON.stringify(props.inputs)},
}, "query": "What are the specs of the iPhone 13 Pro Max?",
"query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "streaming",
"conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "conversation_id": "",
"response_mode": "streaming", "user": "abc-123",
"user": "abc-123", "files": [
"files": [ {
{ "type": "image",
"type": "image", "transfer_method": "remote_url",
"transfer_method": "remote_url", "url": "https://cloud.dify.ai/logo/logo-site.png"
"url": "https://cloud.dify.ai/logo/logo-site.png" }
} ]
] }'`}
}' />
```
</CodeGroup>
### 阻塞模式 ### 阻塞模式
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
"event": "message", "event": "message",
"task_id": "c3800678-a077-43df-a102-53f23ed20b88", "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
"id": "9da23599-e713-473b-982c-4328d4f5c78a", "id": "9da23599-e713-473b-982c-4328d4f5c78a",
"message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
"conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
@@ -345,15 +335,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -381,7 +371,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Row> <Row>
<Col> <Col>
预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。
<i>文件只能在属于请求应用程序的消息范围内访问。</i> <i>文件只能在属于请求应用程序的消息范围内访问。</i>
### 路径参数 ### 路径参数
@@ -409,7 +399,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
### 请求示例 ### 请求示例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
tag="GET"
label="/files/:file_id/preview"
targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
--header 'Authorization: Bearer {api_key}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \
@@ -419,15 +414,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</CodeGroup> </CodeGroup>
### 作为附件下载 ### 作为附件下载
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\\\\n--header 'Authorization: Bearer {api_key}' \\\\\\n--output downloaded_file.png`}> <CodeGroup title="Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--header 'Authorization: Bearer {api_key}' \\
```bash {{ title: 'cURL' }} --output downloaded_file.png`}
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ />
--header 'Authorization: Bearer {api_key}' \
--output downloaded_file.png
```
</CodeGroup>
### 响应标头示例 ### 响应标头示例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -470,17 +460,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `result` (string) 固定返回 success - `result` (string) 固定返回 success
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/chat-messages/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{ "user": "abc-123"}'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -529,20 +517,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \ label="/messages/:message_id/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"rating": "like", --data-raw '{
"user": "abc-123", "rating": "like",
"content": "message feedback information" "user": "abc-123",
}' "content": "message feedback information"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -584,15 +571,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \ label="/app/feedbacks"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}
--header 'Content-Type: application/json' />
```
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -646,15 +630,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \ label="/messages/{message_id}/suggested"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123 \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --header 'Content-Type: application/json'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -735,14 +718,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' label="/messages"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Response Example(基础助手) ### Response Example(基础助手)
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -887,14 +869,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \ label="/conversations"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -951,19 +932,17 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="DELETE"
curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \ label="/conversations/:conversation_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\
--header 'Accept: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \\
--data '{ --data-raw '{
"user": "abc-123" "user": "abc-123"
}' }'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```text {{ title: 'Response' }} ```text {{ title: 'Response' }}
@@ -1013,20 +992,19 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \ label="/conversations/:conversation_id/name"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"name": "", --data-raw '{
"auto_generate": true, "name": "",
"user": "abc-123" "auto_generate": true,
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1097,14 +1075,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \ label="/conversations/:conversation_id/variables"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Request with variable name filter"> <CodeGroup title="Request with variable name filter">
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
@@ -1197,19 +1174,18 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="PUT" label="/conversations/:conversation_id/variables/:variable_id" targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "value": "Updated Value",\n "user": "abc-123"\n}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="PUT"
curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \ label="/conversations/:conversation_id/variables/:variable_id"
--header 'Content-Type: application/json' \ targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
--header 'Authorization: Bearer {api_key}' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"value": "Updated Value", --data-raw '{
"user": "abc-123" "value": "Updated Value",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="使用不同值类型更新"> <CodeGroup title="使用不同值类型更新">
```bash {{ title: '字符串值' }} ```bash {{ title: '字符串值' }}
@@ -1287,15 +1263,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/conversations/name' \ label="/audio-to-text"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
--form 'file=@localfile;type=audio/mp3' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1335,15 +1310,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'text=你好Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \ label="/text-to-audio"
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\
--form 'file=你好Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
``` --form 'text=你好Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}
/>
</CodeGroup>
<CodeGroup title="headers"> <CodeGroup title="headers">
```json {{ title: 'headers' }} ```json {{ title: 'headers' }}
@@ -1373,12 +1347,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- 'author_name' (string) 作者名称 - 'author_name' (string) 作者名称
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1444,30 +1419,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `default` (string) 默认值 - `default` (string) 默认值
- `options` (array[string]) 选项值 - `options` (array[string]) 选项值
- `file_upload` (object) 文件上传配置 - `file_upload` (object) 文件上传配置
- `document` (object) 文档设置 - `document` (object) 文档设置
当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 文档数量限制,默认为 3 - `number_limits` (int) 文档数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `image` (object) 图片设置 - `image` (object) 图片设置
当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 图片数量限制,默认为 3 - `number_limits` (int) 图片数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `audio` (object) 音频设置 - `audio` (object) 音频设置
当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 音频数量限制,默认为 3 - `number_limits` (int) 音频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `video` (object) 视频设置 - `video` (object) 视频设置
当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 视频数量限制,默认为 3 - `number_limits` (int) 视频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `custom` (object) 自定义设置 - `custom` (object) 自定义设置
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 自定义数量限制,默认为 3 - `number_limits` (int) 自定义数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `system_parameters` (object) 系统参数 - `system_parameters` (object) 系统参数
- `file_size_limit` (int) 文档上传大小限制 (MB) - `file_size_limit` (int) 文档上传大小限制 (MB)
- `image_file_size_limit` (int) 图片文件上传大小限制MB - `image_file_size_limit` (int) 图片文件上传大小限制MB
@@ -1476,14 +1451,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1546,13 +1520,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- (string) 图标 URL - (string) 图标 URL
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/meta' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1598,13 +1572,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
- `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖 - `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ Workflow applications offers non-session support and is ideal for translation, a
<div> <div>
### Base URL ### Base URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### Authentication ### Authentication
@@ -19,12 +16,7 @@ Workflow applications offers non-session support and is ideal for translation, a
For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below: For all API requests, include your API Key in the `Authorization` HTTP Header, as shown below:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -45,8 +37,8 @@ Workflow applications offers non-session support and is ideal for translation, a
The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable.
The workflow application requires at least one key/value pair to be inputted. The variable can be of File Array type. The workflow application requires at least one key/value pair to be inputted. The variable can be of File Array type.
File Array type variable is suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability. File Array type variable is suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability.
If the variable is of File Array type, the corresponding value should be a list whose elements contain following attributions: If the variable is of File Array type, the corresponding value should be a list whose elements contain following attributions:
- `type` (string) Supported type: - `type` (string) Supported type:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR') - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
@@ -123,9 +115,9 @@ Workflow applications offers non-session support and is ideal for translation, a
- `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
- `inputs` (object) Contents of all preceding node variables used in the node - `inputs` (object) Contents of all preceding node variables used in the node
- `created_at` (timestamp) timestamp of start, e.g., 1705395332 - `created_at` (timestamp) timestamp of start, e.g., 1705395332
- `event: text_chunk` Text fragment - `event: text_chunk` Text fragment
- `task_id` (string) Task ID, used for request tracking and the below Stop Generate API - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
- `workflow_run_id` (string) Unique ID of workflow execution - `workflow_run_id` (string) Unique ID of workflow execution
- `event` (string) fixed to `text_chunk` - `event` (string) fixed to `text_chunk`
- `data` (object) detail - `data` (object) detail
- `text` (string) Text content - `text` (string) Text content
@@ -190,25 +182,24 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/workflows/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/workflows/run' \ label="/workflows/run"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"response_mode": "streaming", "inputs": ${JSON.stringify(props.inputs)},
"user": "abc-123" "response_mode": "streaming",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="Example: file array as an input variable"> <CodeGroup title="Example: file array as an input variable">
```json {{ title: 'File variable example' }} ```json {{ title: 'File variable example' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -264,7 +255,7 @@ Workflow applications offers non-session support and is ideal for translation, a
headers = { headers = {
"Authorization": "Bearer app-xxxxxxxx", "Authorization": "Bearer app-xxxxxxxx",
} }
try: try:
print("Upload file...") print("Upload file...")
with open(file_path, 'rb') as file: with open(file_path, 'rb') as file:
@@ -275,7 +266,7 @@ Workflow applications offers non-session support and is ideal for translation, a
"user": user, "user": user,
"type": "TXT" # Set the file type to TXT "type": "TXT" # Set the file type to TXT
} }
response = requests.post(upload_url, headers=headers, files=files, data=data) response = requests.post(upload_url, headers=headers, files=files, data=data)
if response.status_code == 201: # 201 means creation is successful if response.status_code == 201: # 201 means creation is successful
print("File uploaded successfully") print("File uploaded successfully")
@@ -350,7 +341,7 @@ Workflow applications offers non-session support and is ideal for translation, a
### Path ### Path
- `workflow_id` (string) Required Workflow ID to specify a specific version of workflow - `workflow_id` (string) Required Workflow ID to specify a specific version of workflow
How to obtain: In the version history interface, click the copy icon on the right side of each version entry to copy the complete workflow ID. Each version entry contains a copyable ID field. How to obtain: In the version history interface, click the copy icon on the right side of each version entry to copy the complete workflow ID. Each version entry contains a copyable ID field.
### Request Body ### Request Body
@@ -359,8 +350,8 @@ Workflow applications offers non-session support and is ideal for translation, a
The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable.
The workflow application requires at least one key/value pair to be inputted. The variable can be of File Array type. The workflow application requires at least one key/value pair to be inputted. The variable can be of File Array type.
File Array type variable is suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability. File Array type variable is suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability.
If the variable is of File Array type, the corresponding value should be a list whose elements contain following attributions: If the variable is of File Array type, the corresponding value should be a list whose elements contain following attributions:
- `type` (string) Supported type: - `type` (string) Supported type:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR') - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
@@ -437,8 +428,8 @@ Workflow applications offers non-session support and is ideal for translation, a
- `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
- `inputs` (object) Contents of all preceding node variables used in the node - `inputs` (object) Contents of all preceding node variables used in the node
- `created_at` (timestamp) timestamp of start, e.g., 1705395332 - `created_at` (timestamp) timestamp of start, e.g., 1705395332
- `event: text_chunk` Text fragment - `event: text_chunk` Text fragment
- `task_id` (string) Task ID, used for request tracking and the below Stop Generate API - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
- `workflow_run_id` (string) Unique ID of workflow execution - `workflow_run_id` (string) Unique ID of workflow execution
- `event` (string) fixed to `text_chunk` - `event` (string) fixed to `text_chunk`
- `data` (object) detail - `data` (object) detail
@@ -505,23 +496,24 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/workflows/:workflow_id/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \ tag="POST"
--header 'Authorization: Bearer {api_key}' \ label="/workflows/:workflow_id/run"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"inputs": {}, --header 'Content-Type: application/json' \\
"response_mode": "streaming", --data-raw '{
"user": "abc-123" "inputs": ${JSON.stringify(props.inputs)},
}' "response_mode": "streaming",
``` "user": "abc-123"
</CodeGroup> }'`}
/>
<CodeGroup title="Example: file array as an input variable"> <CodeGroup title="Example: file array as an input variable">
```json {{ title: 'File variable example' }} ```json {{ title: 'File variable example' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -598,13 +590,14 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_run_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \ tag="GET"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/run/:workflow_run_id"
-H 'Content-Type: application/json' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\
``` -H 'Authorization: Bearer {api_key}' \\
</CodeGroup> -H 'Content-Type: application/json'`}
/>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -647,17 +640,16 @@ Workflow applications offers non-session support and is ideal for translation, a
- `result` (string) Always returns "success" - `result` (string) Always returns "success"
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/workflows/tasks/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/tasks/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{"user": "abc-123"}'`}
``` />
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -717,16 +709,15 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -756,7 +747,7 @@ Workflow applications offers non-session support and is ideal for translation, a
<Row> <Row>
<Col> <Col>
Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API.
<i>Files can only be accessed if they belong to messages within the requesting application.</i> <i>Files can only be accessed if they belong to messages within the requesting application.</i>
### Path Parameters ### Path Parameters
@@ -784,25 +775,23 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Download as Attachment ### Download as Attachment
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### Response Headers Example ### Response Headers Example
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -889,14 +878,13 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/workflows/logs" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/workflows/logs?limit=1' label="/workflows/logs"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -956,12 +944,13 @@ Workflow applications offers non-session support and is ideal for translation, a
- `author_name` (string) application author name - `author_name` (string) application author name
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1010,30 +999,30 @@ Workflow applications offers non-session support and is ideal for translation, a
- `default` (string) Default value - `default` (string) Default value
- `options` (array[string]) Option values - `options` (array[string]) Option values
- `file_upload` (object) File upload configuration - `file_upload` (object) File upload configuration
- `document` (object) Document settings - `document` (object) Document settings
Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`. Currently only supports document types: `txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Document number limit, default is 3 - `number_limits` (int) Document number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `image` (object) Image settings - `image` (object) Image settings
Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Image number limit, default is 3 - `number_limits` (int) Image number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `audio` (object) Audio settings - `audio` (object) Audio settings
Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`. Currently only supports audio types: `mp3`, `m4a`, `wav`, `webm`, `amr`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Audio number limit, default is 3 - `number_limits` (int) Audio number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `video` (object) Video settings - `video` (object) Video settings
Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`. Currently only supports video types: `mp4`, `mov`, `mpeg`, `mpga`.
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Video number limit, default is 3 - `number_limits` (int) Video number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `custom` (object) Custom settings - `custom` (object) Custom settings
- `enabled` (bool) Whether it is enabled - `enabled` (bool) Whether it is enabled
- `number_limits` (int) Custom number limit, default is 3 - `number_limits` (int) Custom number limit, default is 3
- `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one. - `transfer_methods` (array[string]) List of transfer methods: `remote_url`, `local_file`. Must choose one.
- `system_parameters` (object) System parameters - `system_parameters` (object) System parameters
- `file_size_limit` (int) Document upload size limit (MB) - `file_size_limit` (int) Document upload size limit (MB)
- `image_file_size_limit` (int) Image file upload size limit (MB) - `image_file_size_limit` (int) Image file upload size limit (MB)
@@ -1043,14 +1032,12 @@ Workflow applications offers non-session support and is ideal for translation, a
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1112,13 +1099,13 @@ Workflow applications offers non-session support and is ideal for translation, a
- `show_workflow_steps` (bool) Whether to show workflow details - `show_workflow_steps` (bool) Whether to show workflow details
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<div> <div>
### ベース URL ### ベース URL
<CodeGroup title="コード" targetCode={props.appDetail.api_base_url}> <CodeGroup title="コード" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### 認証 ### 認証
@@ -19,12 +16,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
すべての API リクエストにおいて、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください: すべての API リクエストにおいて、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください:
<CodeGroup title="コード"> <CodeGroup title="コード" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -47,7 +39,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
ファイルリストは、テキスト理解と質問への回答を組み合わせたファイルの入力に適しています。モデルがファイルの解析と理解機能をサポートしている場合にのみ使用できます。 ファイルリストは、テキスト理解と質問への回答を組み合わせたファイルの入力に適しています。モデルがファイルの解析と理解機能をサポートしている場合にのみ使用できます。
変数がファイルリストの場合、リストの各要素は以下の属性を持つ必要があります。 変数がファイルリストの場合、リストの各要素は以下の属性を持つ必要があります。
- `type` (string) サポートされているタイプ: - `type` (string) サポートされているタイプ:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR') - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
@@ -71,7 +63,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
1. HeaderHTTPヘッダー `X-Trace-Id` で渡す(最優先)。 1. HeaderHTTPヘッダー `X-Trace-Id` で渡す(最優先)。
2. クエリパラメータURLクエリパラメータ `trace_id` で渡す。 2. クエリパラメータURLクエリパラメータ `trace_id` で渡す。
3. リクエストボディ:リクエストボディの `trace_id` フィールドで渡す(本フィールド)。 3. リクエストボディ:リクエストボディの `trace_id` フィールドで渡す(本フィールド)。
### 応答 ### 応答
`response_mode`が`blocking`の場合、CompletionResponse オブジェクトを返します。 `response_mode`が`blocking`の場合、CompletionResponse オブジェクトを返します。
@@ -190,25 +182,24 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/workflows/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/workflows/run' \ label="/workflows/run"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer {api_key}' \\
--data-raw '{ --header 'Content-Type: application/json' \\
"inputs": {}, --data-raw '{
"response_mode": "streaming", "inputs": ${JSON.stringify(props.inputs)},
"user": "abc-123" "response_mode": "streaming",
}' "user": "abc-123"
``` }'`}
/>
</CodeGroup>
<CodeGroup title="ファイル変数の例"> <CodeGroup title="ファイル変数の例">
```json {{ title: 'ファイル変数の例' }} ```json {{ title: 'ファイル変数の例' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -264,7 +255,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
headers = { headers = {
"Authorization": "Bearer app-xxxxxxxx", "Authorization": "Bearer app-xxxxxxxx",
} }
try: try:
print("ファイルをアップロードしています...") print("ファイルをアップロードしています...")
with open(file_path, 'rb') as file: with open(file_path, 'rb') as file:
@@ -275,7 +266,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
"user": user, "user": user,
"type": "TXT" # ファイルタイプをTXTに設定します "type": "TXT" # ファイルタイプをTXTに設定します
} }
response = requests.post(upload_url, headers=headers, files=files, data=data) response = requests.post(upload_url, headers=headers, files=files, data=data)
if response.status_code == 201: # 201 は作成が成功したことを意味します if response.status_code == 201: # 201 は作成が成功したことを意味します
print("ファイルが正常にアップロードされました") print("ファイルが正常にアップロードされました")
@@ -350,7 +341,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
### パス ### パス
- `workflow_id` (string) 必須 特定バージョンのワークフローを指定するためのワークフローID - `workflow_id` (string) 必須 特定バージョンのワークフローを指定するためのワークフローID
取得方法バージョン履歴で特定バージョンのワークフローIDを照会できます。 取得方法バージョン履歴で特定バージョンのワークフローIDを照会できます。
### リクエストボディ ### リクエストボディ
@@ -500,23 +491,24 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="POST" label="/workflows/:workflow_id/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \ tag="POST"
--header 'Authorization: Bearer {api_key}' \ label="/workflows/:workflow_id/run"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"inputs": {}, --header 'Content-Type: application/json' \\
"response_mode": "streaming", --data-raw '{
"user": "abc-123" "inputs": ${JSON.stringify(props.inputs)},
}' "response_mode": "streaming",
``` "user": "abc-123"
</CodeGroup> }'`}
/>
<CodeGroup title="例:入力変数としてのファイル配列"> <CodeGroup title="例:入力変数としてのファイル配列">
```json {{ title: 'ファイル変数の例' }} ```json {{ title: 'ファイル変数の例' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -593,13 +585,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="GET" label="/workflows/run/:workflow_run_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \ tag="GET"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/run/:workflow_run_id"
-H 'Content-Type: application/json' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\
``` -H 'Authorization: Bearer {api_key}' \\
</CodeGroup> -H 'Content-Type: application/json'`}
/>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
@@ -642,17 +635,16 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `result` (string) 常に"success"を返します - `result` (string) 常に"success"を返します
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/workflows/tasks/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="リクエスト"
curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/tasks/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{"user": "abc-123"}'`}
``` />
</CodeGroup>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
@@ -712,15 +704,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="リクエスト" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
### 応答例 ### 応答例
@@ -751,7 +743,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
<Row> <Row>
<Col> <Col>
アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
<i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i> <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
### パスパラメータ ### パスパラメータ
@@ -779,25 +771,23 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
### リクエスト例 ### リクエスト例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL - ブラウザプレビュー' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 添付ファイルとしてダウンロード ### 添付ファイルとしてダウンロード
<CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}> <CodeGroup
title="Download Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### レスポンスヘッダー例 ### レスポンスヘッダー例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -884,14 +874,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/workflows/logs" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/workflows/logs?limit=1' label="/workflows/logs"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 応答例 ### 応答例
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -951,12 +940,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `author_name` (string) 作者の名前 - `author_name` (string) 作者の名前
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -1005,30 +995,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `default` (string) デフォルト値 - `default` (string) デフォルト値
- `options` (array[string]) オプション値 - `options` (array[string]) オプション値
- `file_upload` (object) ファイルアップロード設定 - `file_upload` (object) ファイルアップロード設定
- `document` (object) ドキュメント設定 - `document` (object) ドキュメント設定
現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ドキュメント数の上限。デフォルトは 3 - `number_limits` (int) ドキュメント数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `image` (object) 画像設定 - `image` (object) 画像設定
現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。 現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) 画像数の上限。デフォルトは 3 - `number_limits` (int) 画像数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `audio` (object) オーディオ設定 - `audio` (object) オーディオ設定
現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。 現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) オーディオ数の上限。デフォルトは 3 - `number_limits` (int) オーディオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `video` (object) ビデオ設定 - `video` (object) ビデオ設定
現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。 現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) ビデオ数の上限。デフォルトは 3 - `number_limits` (int) ビデオ数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `custom` (object) カスタム設定 - `custom` (object) カスタム設定
- `enabled` (bool) 有効かどうか - `enabled` (bool) 有効かどうか
- `number_limits` (int) カスタム数の上限。デフォルトは 3 - `number_limits` (int) カスタム数の上限。デフォルトは 3
- `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。 - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
- `system_parameters` (object) システムパラメータ - `system_parameters` (object) システムパラメータ
- `file_size_limit` (int) ドキュメントアップロードサイズ制限MB - `file_size_limit` (int) ドキュメントアップロードサイズ制限MB
- `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB - `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限MB
@@ -1038,14 +1028,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="リクエスト" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="リクエスト"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="応答"> <CodeGroup title="応答">
```json {{ title: '応答' }} ```json {{ title: '応答' }}
@@ -1107,13 +1095,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
- `show_workflow_steps` (bool) ワークフローの詳細を表示するかどうか - `show_workflow_steps` (bool) ワークフローの詳細を表示するかどうか
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}

View File

@@ -7,10 +7,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<div> <div>
### Base URL ### Base URL
<CodeGroup title="Code" targetCode={props.appDetail.api_base_url}> <CodeGroup title="Code" targetCode={props.appDetail.api_base_url} />
```javascript
```
</CodeGroup>
### Authentication ### Authentication
@@ -18,12 +15,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i> <i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i>
所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示: 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
<CodeGroup title="Code"> <CodeGroup title="Code" targetCode='Authorization: Bearer {API_KEY}' />
```javascript
Authorization: Bearer {API_KEY}
```
</CodeGroup>
</div> </div>
--- ---
@@ -31,7 +23,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<Heading <Heading
url='/workflows/run' url='/workflows/run'
method='POST' method='POST'
title='执行 workflow' title='执行 Workflow'
name='#Execute-Workflow' name='#Execute-Workflow'
/> />
<Row> <Row>
@@ -182,23 +174,24 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/workflows/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/workflows/run' \ tag="POST"
--header 'Authorization: Bearer {api_key}' \ label="/workflows/run"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"inputs": {}, --header 'Content-Type: application/json' \\
"response_mode": "streaming", --data-raw '{
"user": "abc-123" "inputs": ${JSON.stringify(props.inputs)},
}' "response_mode": "streaming",
``` "user": "abc-123"
</CodeGroup> }'`}
/>
<CodeGroup title="Example: file array as an input variable"> <CodeGroup title="Example: file array as an input variable">
```json {{ title: 'File variable example' }} ```json {{ title: 'File variable example' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -254,7 +247,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
headers = { headers = {
"Authorization": "Bearer app-xxxxxxxx", "Authorization": "Bearer app-xxxxxxxx",
} }
try: try:
print("上传文件中...") print("上传文件中...")
with open(file_path, 'rb') as file: with open(file_path, 'rb') as file:
@@ -265,7 +258,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
"user": user, "user": user,
"type": "TXT" # 设置文件类型为TXT "type": "TXT" # 设置文件类型为TXT
} }
response = requests.post(upload_url, headers=headers, files=files, data=data) response = requests.post(upload_url, headers=headers, files=files, data=data)
if response.status_code == 201: # 201 表示创建成功 if response.status_code == 201: # 201 表示创建成功
print("文件上传成功") print("文件上传成功")
@@ -331,7 +324,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<Heading <Heading
url='/workflows/:workflow_id/run' url='/workflows/:workflow_id/run'
method='POST' method='POST'
title='执行指定版本 workflow' title='执行指定版本 Workflow'
name='#Execute-Specific-Workflow' name='#Execute-Specific-Workflow'
/> />
<Row> <Row>
@@ -340,7 +333,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
### Path ### Path
- `workflow_id` (string) Required 工作流ID用于指定特定版本的工作流 - `workflow_id` (string) Required 工作流ID用于指定特定版本的工作流
获取方式可以在版本历史中查询特定版本的工作流ID。 获取方式可以在版本历史中查询特定版本的工作流ID。
### Request Body ### Request Body
@@ -490,23 +483,24 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/workflows/:workflow_id/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \ tag="POST"
--header 'Authorization: Bearer {api_key}' \ label="/workflows/:workflow_id/run"
--header 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/{workflow_id}/run' \\
--data-raw '{ --header 'Authorization: Bearer {api_key}' \\
"inputs": {}, --header 'Content-Type: application/json' \\
"response_mode": "streaming", --data-raw '{
"user": "abc-123" "inputs": ${JSON.stringify(props.inputs)},
}' "response_mode": "streaming",
``` "user": "abc-123"
</CodeGroup> }'`}
/>
<CodeGroup title="Example: file array as an input variable"> <CodeGroup title="Example: file array as an input variable">
```json {{ title: 'File variable example' }} ```json {{ title: 'File variable example' }}
{ {
"inputs": { "inputs": {
"{variable_name}": "{variable_name}":
[ [
{ {
"transfer_method": "local_file", "transfer_method": "local_file",
@@ -560,7 +554,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<Heading <Heading
url='/workflows/run/:workflow_run_id' url='/workflows/run/:workflow_run_id'
method='GET' method='GET'
title='获取workflow执行情况' title='获取 Workflow 执行情况'
name='#get-workflow-run-detail' name='#get-workflow-run-detail'
/> />
<Row> <Row>
@@ -583,13 +577,14 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_run_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \ tag="GET"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/run/:workflow_run_id"
-H 'Content-Type: application/json' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\
``` -H 'Authorization: Bearer {api_key}' \\
</CodeGroup> -H 'Content-Type: application/json'`}
/>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -633,16 +628,15 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
### Request Example ### Request Example
<CodeGroup title="Request" tag="POST" label="/workflows/tasks/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \ tag="POST"
-H 'Authorization: Bearer {api_key}' \ label="/workflows/tasks/:task_id/stop"
-H 'Content-Type: application/json' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\
--data-raw '{ -H 'Authorization: Bearer {api_key}' \\
"user": "abc-123" -H 'Content-Type: application/json' \\
}' --data-raw '{"user": "abc-123"}'`}
``` />
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
@@ -703,15 +697,15 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="POST"
curl -X POST '${props.appDetail.api_base_url}/files/upload' \ label="/files/upload"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
--form 'file=@"/path/to/file"' --header 'Authorization: Bearer {api_key}' \\
``` --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
--form 'user=abc-123'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -739,7 +733,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<Row> <Row>
<Col> <Col>
预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。
<i>文件只能在属于请求应用程序的消息范围内访问。</i> <i>文件只能在属于请求应用程序的消息范围内访问。</i>
### 路径参数 ### 路径参数
@@ -767,25 +761,23 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
### 请求示例 ### 请求示例
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \ label="/files/:file_id/preview"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### 作为附件下载 ### 作为附件下载
<CodeGroup title="Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\\\\n--header 'Authorization: Bearer {api_key}' \\\\\\n--output downloaded_file.png`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \ label="/files/:file_id/preview?as_attachment=true"
--header 'Authorization: Bearer {api_key}' \ targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
--output downloaded_file.png --header 'Authorization: Bearer {api_key}' \\
``` --output downloaded_file.png`}
/>
</CodeGroup>
### 响应标头示例 ### 响应标头示例
<CodeGroup title="Response Headers"> <CodeGroup title="Response Headers">
@@ -812,7 +804,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
<Heading <Heading
url='/workflows/logs' url='/workflows/logs'
method='GET' method='GET'
title='获取 workflow 日志' title='获取 Workflow 日志'
name='#Get-Workflow-Logs' name='#Get-Workflow-Logs'
/> />
<Row> <Row>
@@ -871,14 +863,13 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/workflows/logs" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\\n --header 'Authorization: Bearer {api_key}'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/workflows/logs?limit=1' label="/workflows/logs"
--header 'Authorization: Bearer {api_key}' targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\
``` --header 'Authorization: Bearer {api_key}'`}
/>
</CodeGroup>
### Response Example ### Response Example
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -937,12 +928,13 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
- 'author_name' (string) 作者名称 - 'author_name' (string) 作者名称
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/info' \ tag="GET"
-H 'Authorization: Bearer {api_key}' label="/info"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
</CodeGroup> -H 'Authorization: Bearer {api_key}'`}
/>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
@@ -991,30 +983,30 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
- `default` (string) 默认值 - `default` (string) 默认值
- `options` (array[string]) 选项值 - `options` (array[string]) 选项值
- `file_upload` (object) 文件上传配置 - `file_upload` (object) 文件上传配置
- `document` (object) 文档设置 - `document` (object) 文档设置
当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 文档数量限制,默认为 3 - `number_limits` (int) 文档数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `image` (object) 图片设置 - `image` (object) 图片设置
当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 图片数量限制,默认为 3 - `number_limits` (int) 图片数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `audio` (object) 音频设置 - `audio` (object) 音频设置
当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 音频数量限制,默认为 3 - `number_limits` (int) 音频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `video` (object) 视频设置 - `video` (object) 视频设置
当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 视频数量限制,默认为 3 - `number_limits` (int) 视频数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `custom` (object) 自定义设置 - `custom` (object) 自定义设置
- `enabled` (bool) 是否启用 - `enabled` (bool) 是否启用
- `number_limits` (int) 自定义数量限制,默认为 3 - `number_limits` (int) 自定义数量限制,默认为 3
- `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
- `system_parameters` (object) 系统参数 - `system_parameters` (object) 系统参数
- `file_size_limit` (int) 文档上传大小限制 (MB) - `file_size_limit` (int) 文档上传大小限制 (MB)
- `image_file_size_limit` (int) 图片文件上传大小限制MB - `image_file_size_limit` (int) 图片文件上传大小限制MB
@@ -1024,14 +1016,12 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
</Col> </Col>
<Col sticky> <Col sticky>
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}> <CodeGroup
title="Request"
```bash {{ title: 'cURL' }} tag="GET"
curl -X GET '${props.appDetail.api_base_url}/parameters' \ label="/parameters"
--header 'Authorization: Bearer {api_key}' targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}
``` />
</CodeGroup>
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
@@ -1094,13 +1084,13 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等
- `show_workflow_steps` (bool) 是否显示工作流详情 - `show_workflow_steps` (bool) 是否显示工作流详情
</Col> </Col>
<Col> <Col>
<CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> <CodeGroup
```bash {{ title: 'cURL' }} title="Request"
curl -X GET '${props.appDetail.api_base_url}/site' \ tag="POST"
-H 'Authorization: Bearer {api_key}' label="/meta"
``` targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
-H 'Authorization: Bearer {api_key}'`}
</CodeGroup> />
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}