mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 22:41:12 +02:00
feat(copilot): replace LangGraph config with request-scoped context variables
- Refactor `llm_call` and `generate_title` nodes to retrieve `llm_config` from request-scoped context variable instead of LangGraph config - Remove `jwt_token` and `llm_config` from LangGraph configurable parameters in `AgentService.stream` - Add `set_current_llm_config` and `get_current_llm_config` functions to `connector_factory` and export them in `__init__.py` - Update `tool_node` to no longer extract `jwt_token` from config as it is now handled via context variable - Improves thread safety and decouples configuration from LangGraph's state management
This commit is contained in:
1 parent
b05e6a71b4
commit
eec4ebe3fd
4 files changed
+43
-20
No files matched your search
@@ -123,12 +123,18 @@ class AgentService:
|
||||
Yields:
|
||||
Dict containing SSE-compatible response chunks
|
||||
"""
|
||||
# Build config with LLM configuration and metadata
|
||||
# Set request-scoped context variables (memory-only, not persisted)
|
||||
if jwt_token:
|
||||
from gns3server.agent.gns3_copilot.gns3_client import set_current_jwt_token
|
||||
set_current_jwt_token(jwt_token)
|
||||
if llm_config:
|
||||
from gns3server.agent.gns3_copilot.gns3_client import set_current_llm_config
|
||||
set_current_llm_config(llm_config)
|
||||
|
||||
# Build config - only thread-safe identifiers
|
||||
config = {
|
||||
"configurable": {
|
||||
"thread_id": session_id,
|
||||
"jwt_token": jwt_token,
|
||||
"llm_config": llm_config,
|
||||
},
|
||||
"metadata": {
|
||||
"user_id": user_id,
|
||||
|
||||
Reference in new issue
Block a user