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:
Xin Wang
2026-03-10 15:34:27 +08:00
parent eab8e15cd6
commit ef2614a70a
14 changed files with 1562 additions and 28 deletions

View File

@@ -153,29 +153,29 @@ def delete_chat_item():
if __name__ == "__main__":
# print("=== Simple Chat ===")
# try:
# simple_chat()
# except Exception as e:
# print(f"Error: {e}")
print("=== Simple Chat ===")
try:
simple_chat()
except Exception as e:
print(f"Error: {e}")
# print("\n=== Streaming Chat ===")
# try:
# streaming_chat()
# except Exception as e:
# print(f"Error: {e}")
print("\n=== Streaming Chat ===")
try:
streaming_chat()
except Exception as e:
print(f"Error: {e}")
# print("\n=== Chat with Context ===")
# try:
# chat_with_context()
# except Exception as e:
# print(f"Error: {e}")
print("\n=== Chat with Context ===")
try:
chat_with_context()
except Exception as e:
print(f"Error: {e}")
# print("\n=== Get Histories ===")
# try:
# get_histories()
# except Exception as e:
# print(f"Error: {e}")
print("\n=== Get Histories ===")
try:
get_histories()
except Exception as e:
print(f"Error: {e}")
print("\n=== Delete Chat Item ===")
try: