Jelajahi Sumber

修改端口

关习习 4 minggu lalu
induk
melakukan
9626a3be7c
2 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 2 2
      api_server.py
  2. 1 1
      client/client.py

+ 2 - 2
api_server.py

@@ -28,7 +28,7 @@ async def message_endpoint(request: Request):
     """
     try:
         data = await request.json()
-        content = json.loads(data.get("content", ""))
+        content = data.get("content", "")
         # 如果需要发送消息,取消下面一行的注释
         send_message(content)
         print(f"Received data: {data.get('content', '')}")
@@ -38,4 +38,4 @@ async def message_endpoint(request: Request):
 
 
 if __name__ == "__main__":
-    uvicorn.run(app, host="0.0.0.0", port=3000)
+    uvicorn.run(app, host="0.0.0.0", port=9017)

+ 1 - 1
client/client.py

@@ -54,7 +54,7 @@ async def _send_record_async(data):
     """异步发送数据到记录端点"""
     async with httpx.AsyncClient() as client:
         try:
-            await client.post("http://localhost:3000/record", json=data, timeout=10)
+            await client.post("http://localhost:9017/record", json=data, timeout=10)
         except Exception as e:
             print(f"异步发送数据到记录端点失败: {e}")