Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -187,6 +187,7 @@ async def read_root():
|
|
| 187 |
return HTMLResponse(content=html_content, status_code=200)
|
| 188 |
|
| 189 |
# 聊天完成处理(保留原有逻辑,未修改)
|
|
|
|
| 190 |
@app.post("/v1/chat/completions")
|
| 191 |
async def chat_completions(request: Request, background_tasks: BackgroundTasks):
|
| 192 |
"""
|
|
@@ -472,6 +473,7 @@ async def chat_completions(request: Request, background_tasks: BackgroundTasks):
|
|
| 472 |
raise HTTPException(status_code=500, detail=f"内部服务器错误: {str(exc)}")
|
| 473 |
|
| 474 |
# 图像生成处理
|
|
|
|
| 475 |
@app.post("/v1/images/generations")
|
| 476 |
async def images_generations(request: Request):
|
| 477 |
"""
|
|
@@ -702,7 +704,8 @@ async def images_generations(request: Request):
|
|
| 702 |
|
| 703 |
# 返回响应
|
| 704 |
return JSONResponse(content=response_json, status_code=200)
|
| 705 |
-
|
|
|
|
| 706 |
@app.get("/v1/models", response_class=JSONResponse)
|
| 707 |
async def get_models():
|
| 708 |
models_data = {
|
|
|
|
| 187 |
return HTMLResponse(content=html_content, status_code=200)
|
| 188 |
|
| 189 |
# 聊天完成处理(保留原有逻辑,未修改)
|
| 190 |
+
@app.post("/ai/v1/chat/completions")
|
| 191 |
@app.post("/v1/chat/completions")
|
| 192 |
async def chat_completions(request: Request, background_tasks: BackgroundTasks):
|
| 193 |
"""
|
|
|
|
| 473 |
raise HTTPException(status_code=500, detail=f"内部服务器错误: {str(exc)}")
|
| 474 |
|
| 475 |
# 图像生成处理
|
| 476 |
+
@app.post("/ai/v1/images/generations")
|
| 477 |
@app.post("/v1/images/generations")
|
| 478 |
async def images_generations(request: Request):
|
| 479 |
"""
|
|
|
|
| 704 |
|
| 705 |
# 返回响应
|
| 706 |
return JSONResponse(content=response_json, status_code=200)
|
| 707 |
+
|
| 708 |
+
@app.get("/ai/v1/models", response_class=JSONResponse)
|
| 709 |
@app.get("/v1/models", response_class=JSONResponse)
|
| 710 |
async def get_models():
|
| 711 |
models_data = {
|