feat(copilot): add user-aware LLM calls and project cleanup

- Modified `llm_call` and `generate_title` functions to accept `config` parameter, extracting `user_id` and `jwt_token` for per-user LLM configuration and API authentication
- Updated `create_base_model_with_tools` and `create_title_model` calls to pass user authentication details
- Added `jwt_token` to state for tool usage in GNS3 API calls
- Integrated chat router into controller API routes under `/chat` endpoint
- Implemented `_cleanup_copilot_agent` method in `Project` class to remove AgentService resources upon project closure, preventing resource leaks
- Enhanced error handling in agent cleanup to avoid interrupting project close operations
This commit is contained in:
YueGuobin committed 2026-03-04 12:26:19 +08:00
1 parent e1f1bb7d9f
commit 73de248381
7 files changed
+772 -5

No files matched your search

@@ -16,6 +16,7 @@
from fastapi import APIRouter, Depends
from . import chat
from . import controller
from . import appliances
from . import computes
@@ -152,3 +153,9 @@ router.include_router(
prefix="/access",
tags=["LLM Model Configurations"]
)
router.include_router(
chat.router,
prefix="/chat",
tags=["Chat"]
)