feat: add chat_tui example for FastGPT with Textual interface
- Introduced a new example script `chat_tui.py` that provides a full-screen Textual interface for interacting with FastGPT. - Implemented streaming chat updates, workflow logging, and modal handling for interactive nodes. - Enhanced FastGPT client with new streaming capabilities and structured event types for better interaction handling. - Normalized base URL handling in the client to prevent duplicate `/api` paths. - Added tests for streaming event parsing and interaction handling.
This commit is contained in:
@@ -12,6 +12,14 @@ from fastgpt_client.exceptions import ValidationError
|
||||
class TestChatClientCreateChatCompletion:
|
||||
"""Test suite for ChatClient.create_chat_completion method."""
|
||||
|
||||
def test_base_url_trailing_api_is_normalized(self, api_key):
|
||||
"""A base URL ending with /api should not produce /api/api/... requests."""
|
||||
|
||||
client = ChatClient(api_key, base_url="https://cloud.fastgpt.cn/api")
|
||||
|
||||
assert client.base_url == "https://cloud.fastgpt.cn"
|
||||
assert str(client._client.base_url) == "https://cloud.fastgpt.cn"
|
||||
|
||||
def test_create_chat_completion_basic(self, api_key, sample_chat_response):
|
||||
"""Test basic chat completion creation."""
|
||||
client = ChatClient(api_key)
|
||||
|
||||
Reference in New Issue
Block a user