diff --git a/fastapi_server/server_dashscope.py b/fastapi_server/server_dashscope.py index 09b7772..8079124 100644 --- a/fastapi_server/server_dashscope.py +++ b/fastapi_server/server_dashscope.py @@ -86,6 +86,7 @@ def sse_chunks_from_text(full_text: str, response_id: str, model: str = "qwen-fl @app.post("/v1/apps/{app_id}/sessions/{session_id}/responses") +@app.post("/api/v1/apps/{app_id}/sessions/{session_id}/responses") async def application_responses( request: Request, app_id: str = Path(...), @@ -168,6 +169,8 @@ async def application_responses( # Compatibility: some SDKs call /apps/{app_id}/completion without /v1 and without session in path @app.post("/apps/{app_id}/completion") @app.post("/v1/apps/{app_id}/completion") +@app.post("/api/apps/{app_id}/completion") +@app.post("/api/v1/apps/{app_id}/completion") async def application_completion( request: Request, app_id: str = Path(...), diff --git a/fastapi_server/test_dashscope_client.py b/fastapi_server/test_dashscope_client.py index 162af2f..45e9e5d 100644 --- a/fastapi_server/test_dashscope_client.py +++ b/fastapi_server/test_dashscope_client.py @@ -27,10 +27,10 @@ except Exception as e: # <<< Paste your running FastAPI base url here >>> -BASE_URL = os.getenv("DS_BASE_URL", "http://localhost:8588") +BASE_URL = os.getenv("DS_BASE_URL", "http://127.0.0.1:8588/api/") # Params -API_KEY = os.getenv("ALI_API_KEY", "test-key") +API_KEY = "salkjhglakshfs" #os.getenv("ALI_API_KEY", "test-key") APP_ID = os.getenv("ALI_APP_ID", "test-app") SESSION_ID = str(uuid.uuid4()) @@ -50,7 +50,9 @@ call_params = { def main(): # Point the SDK to our FastAPI implementation - dashscope.base_http_api_url = BASE_URL + if BASE_URL and ("/api/" in BASE_URL): + dashscope.base_http_api_url = BASE_URL + # dashscope.base_http_api_url = BASE_URL print(f"Using base_http_api_url = {dashscope.base_http_api_url}") print("\nCalling Application.call(stream=True)...\n")