Update main.py
Browse files
main.py
CHANGED
@@ -9,6 +9,7 @@ import asyncio
|
|
9 |
import time
|
10 |
from collections import defaultdict
|
11 |
from typing import List, Dict, Any, Optional, AsyncGenerator
|
|
|
12 |
|
13 |
from aiohttp import ClientSession, ClientTimeout, ClientError
|
14 |
from fastapi import FastAPI, HTTPException, Request, Depends, Header
|
@@ -365,7 +366,7 @@ def create_response(content: str, model: str, finish_reason: Optional[str] = Non
|
|
365 |
return {
|
366 |
"id": f"chatcmpl-{uuid.uuid4()}",
|
367 |
"object": "chat.completion.chunk",
|
368 |
-
"created": int(datetime.now().timestamp()),
|
369 |
"model": model,
|
370 |
"choices": [
|
371 |
{
|
@@ -436,7 +437,7 @@ async def chat_completions(request: ChatRequest, req: Request, api_key: str = De
|
|
436 |
return {
|
437 |
"id": f"chatcmpl-{uuid.uuid4()}",
|
438 |
"object": "chat.completion",
|
439 |
-
"created": int(datetime.now().timestamp()),
|
440 |
"model": request.model,
|
441 |
"choices": [
|
442 |
{
|
|
|
9 |
import time
|
10 |
from collections import defaultdict
|
11 |
from typing import List, Dict, Any, Optional, AsyncGenerator
|
12 |
+
from datetime import datetime # Added import for datetime
|
13 |
|
14 |
from aiohttp import ClientSession, ClientTimeout, ClientError
|
15 |
from fastapi import FastAPI, HTTPException, Request, Depends, Header
|
|
|
366 |
return {
|
367 |
"id": f"chatcmpl-{uuid.uuid4()}",
|
368 |
"object": "chat.completion.chunk",
|
369 |
+
"created": int(datetime.now().timestamp()), # datetime is now correctly imported
|
370 |
"model": model,
|
371 |
"choices": [
|
372 |
{
|
|
|
437 |
return {
|
438 |
"id": f"chatcmpl-{uuid.uuid4()}",
|
439 |
"object": "chat.completion",
|
440 |
+
"created": int(datetime.now().timestamp()), # datetime is now correctly imported
|
441 |
"model": request.model,
|
442 |
"choices": [
|
443 |
{
|