From 056a8a4ad8d983e00401b31255b074b2025c0e78 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Tue, 2 Jun 2026 17:28:49 +0800 Subject: [PATCH] Update example for ssl problem --- examples/stream_chat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/stream_chat.py b/examples/stream_chat.py index dec5022..009a05a 100644 --- a/examples/stream_chat.py +++ b/examples/stream_chat.py @@ -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,