From 32c491cd3fd1ace529a14d1cfa1e594c35774539 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Thu, 8 Jan 2026 17:32:06 +0800 Subject: [PATCH] fix delete chat bug and update fastapi http file --- src/api/endpoints.py | 1 + test/api/fastapi.http | 168 ++++++------------------------------------ 2 files changed, 22 insertions(+), 147 deletions(-) diff --git a/src/api/endpoints.py b/src/api/endpoints.py index 046dc89..72e053a 100644 --- a/src/api/endpoints.py +++ b/src/api/endpoints.py @@ -77,6 +77,7 @@ async def delete_last_two_chat_records( return last_two_data_ids = [record['dataId'] for record in records[-2:]] + logger.info(f"last_two_data_ids: {last_two_data_ids}") # Delete records using SDK for content_id in last_two_data_ids: diff --git a/test/api/fastapi.http b/test/api/fastapi.http index 10e4fc0..dd2ef42 100644 --- a/test/api/fastapi.http +++ b/test/api/fastapi.http @@ -1,157 +1,47 @@ -GET http://127.0.0.1:8000 +@baseUrl = http://127.0.0.1:8080 +### +GET http://127.0.0.1:8080 HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:07:21 GMT -server: uvicorn +connection: close content-length: 32 content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "可以,继续" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:18:14 GMT +date: Thu, 08 Jan 2026 08:58:09 GMT server: uvicorn -content-length: 169 -content-type: application/json -connection: close ### -POST http://127.0.0.1:8000/chat +POST http://127.0.0.1:8080/chat content-type: application/json { - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "没有" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:18:24 GMT -server: uvicorn -content-length: 187 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "没有" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:18:29 GMT -server: uvicorn -content-length: 178 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "是的" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:18:38 GMT -server: uvicorn -content-length: 196 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "十点半" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:19:07 GMT -server: uvicorn -content-length: 247 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "我在现场" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:19:27 GMT -server: uvicorn -content-length: 208 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "text": "我闯红灯了" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:19:40 GMT -server: uvicorn -content-length: 231 -content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/chat -content-type: application/json - -{ - "sessionId": "a0009", + "sessionId": "a1002", "timeStamp": "202503310303", "text": "【拍摄完成】" } HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 03:20:10 GMT -server: uvicorn -content-length: 210 -content-type: application/json connection: close +content-length: 205 +content-type: application/json +date: Thu, 08 Jan 2026 08:59:37 GMT +server: uvicorn ### -POST http://127.0.0.1:8000/get_info +POST http://127.0.0.1:8080/get_info content-type: application/json { - "sessionId": "a0009", + "sessionId": "a1002", "timeStamp": "202503310303", - "key": "acdinfo" + "key": "hphm1" } HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 05:19:05 GMT -server: uvicorn -content-length: 271 -content-type: application/json connection: close +content-length: 97 +content-type: application/json +date: Thu, 08 Jan 2026 09:26:31 GMT +server: uvicorn ### -POST http://127.0.0.1:8000/set_info +POST http://127.0.0.1:8080/set_info content-type: application/json { @@ -162,27 +52,11 @@ content-type: application/json } HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 05:30:03 GMT -server: uvicorn +connection: close content-length: 70 content-type: application/json -connection: close -### -POST http://127.0.0.1:8000/get_info -content-type: application/json - -{ - "sessionId": "a0009", - "timeStamp": "202503310303", - "key": "hphm1" -} - -HTTP/1.1 200 - OK -date: Fri, 20 Jun 2025 05:30:27 GMT +date: Thu, 08 Jan 2026 09:25:49 GMT server: uvicorn -content-length: 97 -content-type: application/json -connection: close ### DELETE http://127.0.0.1:8000/delete_session content-type: application/json