Update example for ssl problem

This commit is contained in:
Xin Wang
2026-06-02 17:28:49 +08:00
parent 30c413b6d4
commit 056a8a4ad8

View File

@@ -16,13 +16,15 @@ Stream Chat CLI - 与 /chat 端点进行流式交互的脚本。
"""
import asyncio
import ssl
import aiohttp
import json
import sys
from datetime import datetime
API_BASE_URL = "http://localhost:8000"
#API_BASE_URL = "http://localhost:8000"
API_BASE_URL = "https://101.89.108.122:8000"
async def stream_chat(session_id: str, text: str):
@@ -35,7 +37,11 @@ async def stream_chat(session_id: str, text: str):
"text": text
}
async with aiohttp.ClientSession() as http_session:
ssl_ctx = ssl.create_default_context()
ssl_ctx.check_hostname = False
ssl_ctx.verify_mode = ssl.CERT_NONE
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=ssl_ctx)) as http_session:
async with http_session.post(
f"{API_BASE_URL}/chat",
json=payload,