mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
feat(docs): enhance AI chat API documentation with examples and details
- Improve POST /chat endpoint documentation with request/response examples
- Add session ID management flow explanation
- Enhance GET /sessions endpoint with query parameters and response example
- Update GET /sessions/{session_id}/history with detailed response structure
- Format parameters as tables for better readability
- Clarify session ID usage in streaming conversations
This commit is contained in:
1 parent
fd34ef494f
commit
9ba02e9436
6 files changed
+486
-35
No files matched your search
@@ -31,7 +31,6 @@ Converts between LangChain messages and OpenAI-compatible format.
|
||||
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
|
||||
@@ -66,15 +65,13 @@ def convert_langchain_to_openai(lc_message) -> Dict[str, Any]:
|
||||
if msg_id is None:
|
||||
msg_id = str(uuid.uuid4())
|
||||
|
||||
# Get timestamp
|
||||
timestamp = getattr(lc_message, "created_at", None)
|
||||
if timestamp is None:
|
||||
timestamp = datetime.utcnow().isoformat()
|
||||
elif hasattr(timestamp, "isoformat"):
|
||||
timestamp = timestamp.isoformat()
|
||||
# Get metadata from message (including created_at)
|
||||
metadata = getattr(lc_message, "metadata", None) or {}
|
||||
if not isinstance(metadata, dict):
|
||||
metadata = {}
|
||||
|
||||
# Base message structure
|
||||
base_msg = {"id": msg_id, "created_at": timestamp, "metadata": {}}
|
||||
# Base message structure (no top-level created_at, only metadata)
|
||||
base_msg = {"id": msg_id, "metadata": metadata}
|
||||
|
||||
# Convert based on message type
|
||||
if isinstance(lc_message, HumanMessage):
|
||||
|
||||
Reference in new issue
Block a user