support xiaozhi; xiaozhi requires /api/
This commit is contained in:
@@ -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("/v1/apps/{app_id}/sessions/{session_id}/responses")
|
||||||
|
@app.post("/api/v1/apps/{app_id}/sessions/{session_id}/responses")
|
||||||
async def application_responses(
|
async def application_responses(
|
||||||
request: Request,
|
request: Request,
|
||||||
app_id: str = Path(...),
|
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
|
# Compatibility: some SDKs call /apps/{app_id}/completion without /v1 and without session in path
|
||||||
@app.post("/apps/{app_id}/completion")
|
@app.post("/apps/{app_id}/completion")
|
||||||
@app.post("/v1/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(
|
async def application_completion(
|
||||||
request: Request,
|
request: Request,
|
||||||
app_id: str = Path(...),
|
app_id: str = Path(...),
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ except Exception as e:
|
|||||||
|
|
||||||
|
|
||||||
# <<< Paste your running FastAPI base url here >>>
|
# <<< 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
|
# 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")
|
APP_ID = os.getenv("ALI_APP_ID", "test-app")
|
||||||
SESSION_ID = str(uuid.uuid4())
|
SESSION_ID = str(uuid.uuid4())
|
||||||
|
|
||||||
@@ -50,7 +50,9 @@ call_params = {
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Point the SDK to our FastAPI implementation
|
# Point the SDK to our FastAPI implementation
|
||||||
|
if BASE_URL and ("/api/" in BASE_URL):
|
||||||
dashscope.base_http_api_url = 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(f"Using base_http_api_url = {dashscope.base_http_api_url}")
|
||||||
|
|
||||||
print("\nCalling Application.call(stream=True)...\n")
|
print("\nCalling Application.call(stream=True)...\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user