修改了数据集上传,修改了模型配置页面
This commit is contained in:
@@ -1 +1 @@
|
||||
0bbf8a1a0807bf0cee9cf3cc5634f318
|
||||
58852b1a007ac2ceb1f790a423c070f2
|
||||
@@ -854,20 +854,8 @@
|
||||
"Datasets"
|
||||
],
|
||||
"summary": "list_datasets",
|
||||
"description": "获取所有数据集列表\n\nArgs:\n list_all: 是否列出data目录下的所有文件(物理文件),默认False(只列出API上传的文件)\n\nReturns:\n StandardResponse: 包含数据集列表的标准响应",
|
||||
"description": "获取数据集列表(只返回filename_mapping.json中记录的文件)\n\nReturns:\n StandardResponse: 包含数据集列表的标准响应",
|
||||
"operationId": "list_datasets_datasets_get",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "list_all",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"title": "List All"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
@@ -878,16 +866,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation Error",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -984,7 +962,7 @@
|
||||
"Models"
|
||||
],
|
||||
"summary": "call_model_api",
|
||||
"description": "调用模型进行对话(支持流式输出)",
|
||||
"description": "调用模型进行对话(强制使用非流式响应)",
|
||||
"operationId": "call_model_api_models__model_id__call_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -1285,7 +1263,7 @@
|
||||
"Models"
|
||||
],
|
||||
"summary": "test_model_connection",
|
||||
"description": "测试模型连接",
|
||||
"description": "测试模型连接 - 禁用流式响应",
|
||||
"operationId": "test_model_connection_models__model_id__test_post",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -1319,6 +1297,23 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sse": {
|
||||
"get": {
|
||||
"summary": "Sse Demo",
|
||||
"description": "SSE模拟大模型流式输出演示",
|
||||
"operationId": "sse_demo_sse_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
|
||||
98
request/static/sse-test.html
Normal file
98
request/static/sse-test.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>SSE流式输出演示</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#messages {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 8px;
|
||||
min-height: 300px;
|
||||
background: white;
|
||||
line-height: 1.6;
|
||||
font-size: 16px;
|
||||
}
|
||||
.message {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.done-indicator {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🚀 大模型流式输出演示</h1>
|
||||
<div id="messages">正在连接服务器...</div>
|
||||
|
||||
<script>
|
||||
const messageBox = document.getElementById('messages');
|
||||
let currentContent = '';
|
||||
|
||||
// 使用相对路径,避免跨域问题
|
||||
const source = new EventSource('/sse');
|
||||
|
||||
source.onopen = function() {
|
||||
console.log('SSE连接已建立');
|
||||
messageBox.innerHTML = '正在生成内容...\n\n';
|
||||
};
|
||||
|
||||
source.onmessage = function(event) {
|
||||
try {
|
||||
const data = JSON.parse(event.data);
|
||||
|
||||
if (data.error) {
|
||||
messageBox.innerHTML += '<div style="color: red;">错误: ' + data.error + '</div>';
|
||||
source.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.content !== undefined && data.content !== null) {
|
||||
// 追加内容
|
||||
currentContent += data.content;
|
||||
messageBox.innerHTML = currentContent;
|
||||
|
||||
// 自动滚动到底部
|
||||
messageBox.scrollTop = messageBox.scrollHeight;
|
||||
}
|
||||
|
||||
if (data.done) {
|
||||
console.log('流式输出完成');
|
||||
messageBox.innerHTML += '\n\n<div class="done-indicator">✅ 内容生成完成!</div>';
|
||||
source.close();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析数据失败:', e);
|
||||
console.log('原始数据:', event.data);
|
||||
}
|
||||
};
|
||||
|
||||
source.onerror = function(error) {
|
||||
console.error('SSE连接出错:', error);
|
||||
messageBox.innerHTML += '<div style="color: red; margin-top: 20px;">❌ 连接失败</div>';
|
||||
source.close();
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user