Unverified Commit 298ad678 authored by Charlie.Wei's avatar Charlie.Wei Committed by GitHub

Add Message Suggested Api (#1326)

Co-authored-by: luowei <glpat-EjySCyNjWiLqAED-YmwM>
parent f4be2b8b
...@@ -295,8 +295,8 @@ class MessageSuggestedQuestionApi(Resource): ...@@ -295,8 +295,8 @@ class MessageSuggestedQuestionApi(Resource):
try: try:
questions = MessageService.get_suggested_questions_after_answer( questions = MessageService.get_suggested_questions_after_answer(
app_model=app_model, app_model=app_model,
user=current_user,
message_id=message_id, message_id=message_id,
user=current_user,
check_enabled=False check_enabled=False
) )
except MessageNotExistsError: except MessageNotExistsError:
......
...@@ -54,6 +54,7 @@ class ConversationDetailApi(AppApiResource): ...@@ -54,6 +54,7 @@ class ConversationDetailApi(AppApiResource):
raise NotFound("Conversation Not Exists.") raise NotFound("Conversation Not Exists.")
return {"result": "success"}, 204 return {"result": "success"}, 204
class ConversationRenameApi(AppApiResource): class ConversationRenameApi(AppApiResource):
@marshal_with(simple_conversation_fields) @marshal_with(simple_conversation_fields)
......
...@@ -10,6 +10,8 @@ from controllers.service_api.app.error import NotChatAppError ...@@ -10,6 +10,8 @@ from controllers.service_api.app.error import NotChatAppError
from controllers.service_api.wraps import AppApiResource from controllers.service_api.wraps import AppApiResource
from libs.helper import TimestampField, uuid_value from libs.helper import TimestampField, uuid_value
from services.message_service import MessageService from services.message_service import MessageService
from extensions.ext_database import db
from models.model import Account, Message
class MessageListApi(AppApiResource): class MessageListApi(AppApiResource):
...@@ -96,5 +98,36 @@ class MessageFeedbackApi(AppApiResource): ...@@ -96,5 +98,36 @@ class MessageFeedbackApi(AppApiResource):
return {'result': 'success'} return {'result': 'success'}
class MessageSuggestedApi(AppApiResource):
def get(self, app_model, end_user, message_id):
message_id = str(message_id)
if app_model.mode != 'chat':
raise NotChatAppError()
try:
message = db.session.query(Message).filter(
Message.id == message_id,
Message.app_id == app_model.id,
).first()
if end_user is None and message.from_account_id is not None:
user = db.session.get(Account, message.from_account_id)
elif end_user is None and message.from_end_user_id is not None:
user = create_or_update_end_user_for_user_id(app_model, message.from_end_user_id)
else:
user = end_user
questions = MessageService.get_suggested_questions_after_answer(
app_model=app_model,
user=user,
message_id=message_id
)
except services.errors.message.MessageNotExistsError:
raise NotFound("Message Not Exists.")
return {'result': 'success', 'data': questions}
api.add_resource(MessageListApi, '/messages') api.add_resource(MessageListApi, '/messages')
api.add_resource(MessageFeedbackApi, '/messages/<uuid:message_id>/feedbacks') api.add_resource(MessageFeedbackApi, '/messages/<uuid:message_id>/feedbacks')
api.add_resource(MessageSuggestedApi, '/messages/<uuid:message_id>/suggested')
...@@ -63,7 +63,7 @@ For high-quality text generation, such as articles, summaries, and translations, ...@@ -63,7 +63,7 @@ For high-quality text generation, such as articles, summaries, and translations,
<CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-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" tag="POST" label="/completion-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-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`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/completion-messages' \ curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -130,7 +130,7 @@ For high-quality text generation, such as articles, summaries, and translations, ...@@ -130,7 +130,7 @@ For high-quality text generation, such as articles, summaries, and translations,
<CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n --data-raw '{ \n "rating": "like",\n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n --data-raw '{ \n "rating": "like",\n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/messages/{message_id}/feedbacks' \ curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -168,6 +168,55 @@ For high-quality text generation, such as articles, summaries, and translations, ...@@ -168,6 +168,55 @@ For high-quality text generation, such as articles, summaries, and translations,
--- ---
<Heading
url='/messages/{message_id}/suggested'
method='GET'
title='next suggested questions'
name='#suggested'
/>
<Row>
<Col>
Get next questions suggestions for the current message
### Path Params
<Properties>
<Property name='message_id' type='string' key='message_id'>
Message ID
</Property>
</Properties>
</Col>
<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 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
```bash {{ title: 'cURL' }}
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Response' }}
{
"result": "success",
"data": [
"a",
"b",
"c"
]
]
}
```
</CodeGroup>
</Col>
</Row>
---
<Heading <Heading
url='/parameters' url='/parameters'
method='GET' method='GET'
...@@ -191,7 +240,7 @@ For high-quality text generation, such as articles, summaries, and translations, ...@@ -191,7 +240,7 @@ For high-quality text generation, such as articles, summaries, and translations,
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/parameters?user=abc-123' \ curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
......
...@@ -63,7 +63,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -63,7 +63,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-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" tag="POST" label="/completion-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-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`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/completion-messages' \ curl --location --request POST '${props.appDetail.api_base_url}/completion-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -130,7 +130,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -130,7 +130,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n --data-raw '{ \n "rating": "like",\n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n --data-raw '{ \n "rating": "like",\n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/messages/{message_id}/feedbacks' \ curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -168,6 +168,55 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -168,6 +168,55 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
--- ---
<Heading
url='/messages/{message_id}/suggested'
method='GET'
title='消息下一步问题建议'
name='#suggested'
/>
<Row>
<Col>
获取针对当前问题的下一步问题建议
### Path Params
<Properties>
<Property name='message_id' type='string' key='message_id'>
消息 ID
</Property>
</Properties>
</Col>
<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 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
```bash {{ title: 'cURL' }}
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Response' }}
{
"result": "success",
"data": [
"a",
"b",
"c"
]
]
}
```
</CodeGroup>
</Col>
</Row>
---
<Heading <Heading
url='/parameters' url='/parameters'
method='GET' method='GET'
...@@ -191,7 +240,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -191,7 +240,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/parameters?user=abc-123' \ curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
......
...@@ -69,7 +69,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -69,7 +69,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "eh",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123"\n}'\n`}> <CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "eh",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123"\n}'\n`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/chat-messages' \ curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -138,7 +138,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -138,7 +138,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/messages/{message_id}/feedbacks' \ curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -176,6 +176,54 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -176,6 +176,54 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
--- ---
<Heading
url='/messages/{message_id}/suggested'
method='GET'
title='next suggested questions'
name='#suggested'
/>
<Row>
<Col>
Get next questions suggestions for the current message
### Path Params
<Properties>
<Property name='message_id' type='string' key='message_id'>
Message ID
</Property>
</Properties>
</Col>
<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 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
```bash {{ title: 'cURL' }}
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Response' }}
{
"result": "success",
"data": [
"a",
"b",
"c"
]
]
}
```
</CodeGroup>
</Col>
</Row>
---
<Heading <Heading
url='/messages' url='/messages'
method='GET' method='GET'
...@@ -208,7 +256,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -208,7 +256,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/messages?user=abc-123&conversation_id=' curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
...@@ -270,7 +318,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -270,7 +318,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'`}> <CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/conversations?user=abc-123&last_id=&limit=20' \ curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
...@@ -331,7 +379,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -331,7 +379,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="POST" label="/conversations/{converation_id}/name" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/conversations/{converation_id}/name" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/{converation_id}/name' \ curl --location --request POST '${props.appDetail.api_base_url}/conversations/{converation_id}/name' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--data-raw '{ --data-raw '{
...@@ -378,7 +426,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -378,7 +426,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="DELETE" label="/conversations/{converation_id}" targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="DELETE" label="/conversations/{converation_id}" targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request DELETE 'https://cloud.langgenius.dev/api/conversations/{convsation_id}' \ curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'Accept: application/json' \ --header 'Accept: application/json' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
...@@ -415,7 +463,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -415,7 +463,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<Properties> <Properties>
<Property name='file' type='file' key='file'> <Property name='file' type='file' key='file'>
Audio file. Audio file.
File uploads are currently limited to 15 MB and the following input file types are supported: mp3, mp4, mpeg, mpga, m4a, wav, and webm. File uploads are currently limited to 15 MB and the following input file types are supported: mp3, mp4, mpeg, mpga, m4a, wav, and webm.
</Property> </Property>
</Properties> </Properties>
...@@ -425,7 +473,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -425,7 +473,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}> <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/name' \ curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--form 'file=@localfile;type=audio/mp3' --form 'file=@localfile;type=audio/mp3'
``` ```
...@@ -467,7 +515,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API ...@@ -467,7 +515,7 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}> <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/parameters?user=abc-123' \ curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
......
...@@ -69,7 +69,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -69,7 +69,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "eh",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123"\n}'\n`}> <CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "eh",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123"\n}'\n`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/chat-messages' \ curl --location --request POST '${props.appDetail.api_base_url}/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -138,7 +138,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -138,7 +138,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/messages/{message_id}/feedbacks" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/messages/{message_id}/feedbacks' \ curl --location --request POST '${props.appDetail.api_base_url}/messages/{message_id}/feedbacks' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -176,6 +176,54 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -176,6 +176,54 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
--- ---
<Heading
url='/messages/{message_id}/suggested'
method='GET'
title='消息下一步问题建议'
name='#suggested'
/>
<Row>
<Col>
获取针对当前问题的下一步问题建议
### Path Params
<Properties>
<Property name='message_id' type='string' key='message_id'>
消息 ID
</Property>
</Properties>
</Col>
<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 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
```bash {{ title: 'cURL' }}
curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggeste' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Response' }}
{
"result": "success",
"data": [
"a",
"b",
"c"
]
]
}
```
</CodeGroup>
</Col>
</Row>
---
<Heading <Heading
url='/messages' url='/messages'
method='GET' method='GET'
...@@ -208,7 +256,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -208,7 +256,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/messages?user=abc-123&conversation_id=' curl --location --request GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
...@@ -270,7 +318,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -270,7 +318,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/conversations?user=abc-123&last_id=&limit=20' \ curl --location --request GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
...@@ -331,7 +379,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -331,7 +379,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/conversations/{converation_id}/name" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="POST" label="/conversations/{converation_id}/name" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/{converation_id}/name' \ curl --location --request POST '${props.appDetail.api_base_url}/conversations/{converation_id}/name' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
...@@ -377,7 +425,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -377,7 +425,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="DELETE" label="/conversations/{converation_id}" targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}> <CodeGroup title="Request" tag="DELETE" label="/conversations/{converation_id}" targetCode={`curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request DELETE 'https://cloud.langgenius.dev/api/conversations/{convsation_id}' \ curl --location --request DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--header 'Accept: application/json' \ --header 'Accept: application/json' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
...@@ -414,7 +462,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -414,7 +462,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Properties> <Properties>
<Property name='file' type='file' key='file'> <Property name='file' type='file' key='file'>
语音文件。 语音文件。
文件上传当前限制为 15 MB,并且支持以下输入文件类型:mp3、mp4、mpeg、mpga、m4a、wav 和 webm。 文件上传当前限制为 15 MB,并且支持以下输入文件类型:mp3、mp4、mpeg、mpga、m4a、wav 和 webm。
</Property> </Property>
</Properties> </Properties>
...@@ -424,7 +472,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -424,7 +472,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}> <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST 'https://cloud.langgenius.dev/api/conversations/name' \ curl --location --request POST '${props.appDetail.api_base_url}/conversations/name' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \ --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--form 'file=@localfile;type=audio/mp3' --form 'file=@localfile;type=audio/mp3'
``` ```
...@@ -466,7 +514,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' ...@@ -466,7 +514,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl --location --request GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}> <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl --location --request GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'`}>
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request GET 'https://cloud.langgenius.dev/api/parameters?user=abc-123' \ curl --location --request GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY'
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment