Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -5,7 +5,7 @@ from duckai import DuckAI
|
|
5 |
import uvicorn
|
6 |
|
7 |
app = FastAPI()
|
8 |
-
|
9 |
API_PREFIX = "/"
|
10 |
|
11 |
# Middleware for logging request time
|
@@ -48,7 +48,9 @@ async def chat_completions(request: ChatCompletionRequest):
|
|
48 |
try:
|
49 |
# Only using DuckAI directly
|
50 |
content = " ".join([msg.get("content", "") for msg in request.messages])
|
51 |
-
|
|
|
|
|
52 |
results = duck.chat(content, model=request.model)
|
53 |
response = create_complete_response(results, request.model)
|
54 |
return response
|
|
|
5 |
import uvicorn
|
6 |
|
7 |
app = FastAPI()
|
8 |
+
proxy= "socks4://98.178.72.21:10919"
|
9 |
API_PREFIX = "/"
|
10 |
|
11 |
# Middleware for logging request time
|
|
|
48 |
try:
|
49 |
# Only using DuckAI directly
|
50 |
content = " ".join([msg.get("content", "") for msg in request.messages])
|
51 |
+
|
52 |
+
|
53 |
+
duck = DuckAI(proxy=proxy, timeout=20)
|
54 |
results = duck.chat(content, model=request.model)
|
55 |
response = create_complete_response(results, request.model)
|
56 |
return response
|