Browse Source

hypercorn_config.toml
配置文件修改

罗俊辉 1 year ago
parent
commit
f56ce90b35
1 changed files with 4 additions and 19 deletions
  1. 4 19
      applications/routes.py

+ 4 - 19
applications/routes.py

@@ -40,25 +40,10 @@ async def post_data():
         port="title_to_video",
         trace_id=trace_id
     )
-    p = ProcessParams(t_id="trace_id")  # 确保trace_id是有效的,这里用一个示例值代替
-    while True:
-        # 从WebSocket接收数据
-        data = await websocket.receive()
-
-        # 处理数据,假设收到的数据是JSON字符串
-        try:
-            json_data = json.loads(data)
-            processed_data = p.deal(json_data)
-
-            # 发送处理后的数据回客户端
-            await websocket.send(json.dumps(processed_data))
-        except json.JSONDecodeError:
-            # 处理错误情况,比如数据不是JSON格式
-            await websocket.send(json.dumps({'error': 'Invalid data format'}))
-    # p = ProcessParams(t_id=trace_id)
-    # data = await request.get_json()
-    # processed_data = p.deal(data)
-    # return jsonify(processed_data)
+    p = ProcessParams(t_id=trace_id)
+    data = await request.get_json()
+    processed_data = p.deal(data)
+    return jsonify(processed_data)
 
 
 @my_blueprint.route('/search_videos', methods=['POST'])