Update example for ssl problem
This commit is contained in:
@@ -16,13 +16,15 @@ Stream Chat CLI - 与 /chat 端点进行流式交互的脚本。
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import ssl
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
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):
|
async def stream_chat(session_id: str, text: str):
|
||||||
@@ -35,7 +37,11 @@ async def stream_chat(session_id: str, text: str):
|
|||||||
"text": text
|
"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(
|
async with http_session.post(
|
||||||
f"{API_BASE_URL}/chat",
|
f"{API_BASE_URL}/chat",
|
||||||
json=payload,
|
json=payload,
|
||||||
|
|||||||
Reference in New Issue
Block a user