Co-authored-by: luowei <glpat-EjySCyNjWiLqAED-YmwM>tags/0.3.28
| 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: |
| 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) |
| 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): | ||||
| 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') |
| <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 '{ | ||||
| <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 '{ | ||||
| --- | --- | ||||
| <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' | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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 '{ | ||||
| <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 '{ | ||||
| --- | --- | ||||
| <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' | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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 '{ | ||||
| <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 '{ | ||||
| --- | --- | ||||
| <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' | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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 '{ | ||||
| <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' \ | ||||
| <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> | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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 '{ | ||||
| <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 '{ | ||||
| --- | --- | ||||
| <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' | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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 '{ | ||||
| <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' \ | ||||
| <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> | ||||
| <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' | ||||
| ``` | ``` | ||||
| <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' | ||||
| ``` | ``` | ||||