Update api_service.py
Browse files- api_service.py +13 -1
api_service.py
CHANGED
|
@@ -41,7 +41,19 @@ class ApiService:
|
|
| 41 |
|
| 42 |
def get_models(self) -> Dict[str, Any]:
|
| 43 |
"""获取支持的模型列表"""
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def chat_completion(self, request_data: Dict[str, Any], stream: bool = False) -> Generator[str, None, None]:
|
| 47 |
"""处理聊天完成请求"""
|
|
|
|
| 41 |
|
| 42 |
def get_models(self) -> Dict[str, Any]:
|
| 43 |
"""获取支持的模型列表"""
|
| 44 |
+
models = []
|
| 45 |
+
for model_name in ModelMapper.get_available_models():
|
| 46 |
+
models.append({
|
| 47 |
+
"id": model_name,
|
| 48 |
+
"object": "model",
|
| 49 |
+
"created": Utils.get_current_timestamp(),
|
| 50 |
+
"owned_by": "warp-proxy"
|
| 51 |
+
})
|
| 52 |
+
|
| 53 |
+
return {
|
| 54 |
+
"object": "list",
|
| 55 |
+
"data": models
|
| 56 |
+
}
|
| 57 |
|
| 58 |
def chat_completion(self, request_data: Dict[str, Any], stream: bool = False) -> Generator[str, None, None]:
|
| 59 |
"""处理聊天完成请求"""
|