AIGC意图解析解决方案
Project description
意图识别+路径规划
API 调用手册
接口路径 /multi_question 请求方式 POST Content-Type application/json
请求参数
{
"question": "用户提问内容",
"session_id": "会话标识(可选)"
}
- question (必填):用户输入的问题文本
- session_id (可选):用于保持多轮对话的会话ID(建议使用UUID) 成功响应
{
"answer": "AI生成的回答内容"
}
调用示例
Python 示例
import requests
url = "http://localhost:5003/multi_question"
payload = {
"question": "如何查询社保?",
"session_id": "a6d8fe34-7890-4bcd-823e-1a2b3c4d5e6f"
}
response = requests.post(url, json=payload)
print(response.json())
JavaScript 示例
fetch('http://localhost:5003/multi_question', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
question: '如何查询社保?',
session_id: 'a6d8fe34-7890-4bcd-823e-1a2b3c4d5e6f'
})
})
.then(response => response.json())
.then(data => console.log(data));
Java 示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
String json = "{ \"question\":\"如何查询社保?\", \"session_id\":\"a6d8fe34-7890-4bcd-823e-1a2b3c4d5e6f\" }";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:5003/multi_question"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println);
错误处理
400 错误
```json
{
"error": "No question provided"
}
解决方案:确保请求体包含 question 参数
500 错误
{
"error": "Internal server error"
}
解决方案:检查服务端日志排查异常
Session ID 管理
- 首次请求 :可不传 session_id,服务端会自动创建
- 后续请求 :使用服务端返回的 session_id 保持对话连续性
- 建议实现 :
# 生成新 session_id
import uuid
new_session_id = str(uuid.uuid4())
# 客户端应持久化存储 session_id(如 localStorage、数据库等)
注意事项
- 建议设置 10 秒超时机制
- 中文文本请使用 UTF-8 编码
- 生产环境需替换 localhost 为正式域名
- session_id 建议在客户端保留至少 24 小时
- 测试时可添加 debug 参数查看详细日志: app.run(..., debug=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aigc_intent_solt-0.1.0.tar.gz
(16.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aigc_intent_solt-0.1.0.tar.gz.
File metadata
- Download URL: aigc_intent_solt-0.1.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbe9f8f8ffce8be6fbcf829b514525d60a01c2e0d9c98fb95beb6e7efa8e148c
|
|
| MD5 |
d1847f80c5a7cbd72f1f59c6513ea5c4
|
|
| BLAKE2b-256 |
660fca8a90624dd229beec060b739238bab80fe39d83b1aa46d5ee52b1c8b419
|
File details
Details for the file aigc_intent_solt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aigc_intent_solt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96b103c57a2770d5d1b950c7f430587d43f10f5bbf241f882ee42b24c4d7a2f1
|
|
| MD5 |
0ebe6b4212e9f80f687fc696cfc12481
|
|
| BLAKE2b-256 |
3ab51b95074238139ec8dcdaaf9cb45c80d522b6643619bf9c6bcbc6fbead00e
|