zhaoqingang
2024-11-22 8fe444007a471612f2fc1271b61619772b39920d
统一返回的时间格式
3个文件已修改
10 ■■■■ 已修改文件
app/models/dialog_model.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/service/bisheng.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/service/ragflow.py 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/models/dialog_model.py
@@ -57,5 +57,6 @@
        return {
            'id': self.id,
            'updated_time': self.update_time,
            'update_date': self.update_time.strftime('%Y-%m-%d %H:%M:%S'),
            'name': self.name,
        }
app/service/bisheng.py
@@ -68,7 +68,8 @@
                {
                    "id": item["chat_id"],
                    "name": item["latest_message"]["message"],
                    "updated_time": int(datetime.strptime(item["update_time"], "%Y-%m-%dT%H:%M:%S").timestamp() * 1000)
                    "updated_time": int(datetime.strptime(item["update_time"], "%Y-%m-%dT%H:%M:%S").timestamp() * 1000),
                    "update_date": item["update_time"]
                }
                for item in data
                if "latest_message" in item and "message" in item["latest_message"] and item["latest_message"]["message"]
@@ -93,6 +94,7 @@
                {
                    "id": item["chat_id"],
                    "name": process_name(item),
                    "update_date": item["update_time"],
                    "updated_time": int(datetime.strptime(item["update_time"], "%Y-%m-%dT%H:%M:%S").timestamp() * 1000)
                }
                for item in data
app/service/ragflow.py
@@ -1,3 +1,5 @@
from datetime import datetime
import httpx
from typing import Union, Dict, List
from fastapi import HTTPException
@@ -97,7 +99,8 @@
                {
                    "id": item["id"],
                    "name": item["name"],
                    "updated_time": item["update_time"]
                    "updated_time": item["update_time"],
                    "update_date": datetime.utcfromtimestamp(item["update_time"] / 1000.0).strftime('%Y-%m-%d %H:%M:%S')
                }
                for item in data
                if "id" in item and "name" in item and item["name"]