175 Commits

Author SHA1 Message Date
YueGuobin
425ce43bdd feat(chat): add project status checks to chat endpoints
Add project status validation to all chat API endpoints to ensure the project is opened before allowing chat operations. This prevents unauthorized access and ensures chat functionality only works with active projects.

- Check project.status == "opened" in stream_chat, list_sessions, get_history, and delete_session endpoints
- Return HTTP 403 FORBIDDEN with descriptive error message if project is not opened
- Update docstring for stream_chat endpoint to document the requirement
2026-03-04 13:55:09 +08:00
YueGuobin
b05e6a71b4 feat(copilot): refactor JWT token handling and improve metadata tracking
- Move JWT token from state to configurable context for better security and request isolation
- Add user_id parameter to agent service for enhanced metadata tracking
- Update checkpoint directory name from .gns3-copilot to gns3-copilot
- Implement context-aware JWT token management using ContextVar
- Improve tool node to extract JWT token from config instead of state
2026-03-04 13:36:16 +08:00
YueGuobin
b780bfaf53 feat(agent): refactor LLM configuration handling to use centralized config
- Replace separate user_id and jwt_token parameters with unified llm_config dict
- Simplify model factory to accept llm_config directly instead of fetching from API
- Update llm_call and generate_title nodes to extract llm_config from LangGraph config
- Remove deprecated API fetching logic from model factory
- Maintain backward compatibility for existing tool usage patterns

This change centralizes LLM configuration management, reducing API calls and improving performance by passing configuration directly from the API layer rather than fetching it repeatedly.
2026-03-04 13:13:54 +08:00
YueGuobin
2df05dff6e feat(api): nest chat endpoints under projects and refactor dependencies
- Change chat router prefix from `/chat` to `/projects/{project_id}/chat`
- Add `dep_project` dependency to inject Project instance into endpoints
- Remove manual project validation in `stream_chat` and use dependency instead
- Add placeholder `list_sessions` endpoint for future session listing
- Update `get_history` endpoint to use project dependency and adjust path
- Improve code organization and error handling for project retrieval
2026-03-04 12:43:36 +08:00
YueGuobin
479afc01b0 feat(api): add Query parameter description for chat session listing
Add explicit Query parameter with description to the `list_sessions` endpoint for better API documentation and clarity. The `project_id` parameter now includes a descriptive label indicating it is a GNS3 project ID.
2026-03-04 12:35:38 +08:00
YueGuobin
dde2a00c5b feat(agent): update import paths for gns3_copilot modules
Updated import statements across multiple agent files to use absolute paths starting with `gns3server.agent.gns3_copilot` instead of relative `gns3_copilot` imports. This ensures proper module resolution within the gns3-server package structure and prevents import errors when the agent is executed from different contexts.
2026-03-04 12:27:50 +08:00
YueGuobin
73de248381 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
2026-03-04 12:26:19 +08:00
YueGuobin
176b39145b docs: update LLM model configs API documentation for group endpoints
- Add note clarifying that GET endpoints for groups return the same structure as user endpoints
- Document LLMModelConfigListResponse schema with default configuration selection logic
- Add comprehensive example for GET group configurations endpoint
- Update endpoint numbering to accommodate new group endpoints
- Ensure consistency between user and group API documentation
2026-03-03 22:39:38 +08:00
YueGuobin
b06593cf2a feat(docs): add default config endpoints and clarify config inheritance
- Add `/default` endpoints for users and groups to retrieve default LLM model configurations
- Update documentation to clarify that users receive both own and inherited configurations
- Improve response examples to show combined configs with source field
- Add 404 response example for missing default configurations
- Fix optimistic locking documentation formatting
2026-03-03 22:15:17 +08:00
YueGuobin
d42fff49a5 feat(docs): enhance LLM model configs API documentation with schema updates
- Add `model_type` field to database schema with supported values (text, vision, stt, tts, multimodal, embedding, reranking, other)
- Add `name` field as table-level column for indexing and filtering
- Add reserved JSONB fields for future extensibility
- Update API request/response schemas to include `model_type` and `name` fields
- Add new `LLMModelConfigWithSource` schema for detailed configuration responses
- Update usage examples to reflect new required fields
- Improve database constraints and indexing documentation
2026-03-03 17:54:30 +08:00
YueGuobin
161b7feb01 feat(api): add optimistic locking to LLM model config updates
- Include `version` field in all LLM model config response schemas
- Add `expected_version` parameter to update endpoints for optimistic locking
- Handle concurrent modification errors with HTTP 409 Conflict status
- Update both user and group config endpoints consistently
2026-03-03 16:59:12 +08:00
YueGuobin
bbd34f1f67 feat(api): add LLM model configurations endpoint and schemas
- Introduce new API route `/access` for managing LLM model configurations
- Add LLMModelConfig model to database models
- Include comprehensive schemas for LLM model config CRUD operations
- Register new router with tags for LLM Model Configurations
2026-03-03 16:34:48 +08:00
grossmj
47a7324eb5
Fix tests 2026-02-25 19:00:57 +08:00
grossmj
547e68fd2b
Remove unneeded rbac_repo in get_templates 2026-02-23 23:31:35 +08:00
grossmj
bdcb6445c7
Use lists for tags instead of dicts 2026-02-23 23:26:42 +08:00
Guobin Yue
66f32cecf2
Merge branch 'GNS3:3.0' into 3.0 2026-02-23 01:37:05 +08:00
YueGuobin
e27ddf2cdf feat(api): fix ETag handling and JSON serialization in template endpoint
- Use `default=str` in `json.dumps` to handle non-serializable objects
- Return proper HTTP 304 response with ETag header instead of raising exception
- Ensure consistent ETag generation for template caching
2026-02-22 23:43:47 +08:00
YueGuobin
a3616e6d33 feat(api): add tag filtering to nodes and templates endpoints
- Add optional `tags` query parameter to `/nodes` and `/templates` endpoints
- Support filtering by tags in format "key:value" with multiple tags ANDed together
- Example: `?tags=vendor:cisco&tags=model:7200` filters nodes/templates with both tags
- Maintain backward compatibility for existing API usage without tags parameter
2026-02-22 22:52:28 +08:00
grossmj
be4b87e8cd
Update project schema and fix tests 2026-02-22 18:13:08 +08:00
Felix Schulz
8ab34924b5 Add 'created_by' field to track project creator 2026-02-21 22:15:21 +01:00
grossmj
5e3ca29c58
Fix updating packet filters 2026-02-21 21:42:22 +08:00
grossmj
600d3d38da
Fix creating Qemu disk image. Fixes #2542 2026-01-28 19:36:22 +08:00
Jeremy Grossmann
d269a4c125
Merge pull request #2570 from Mytic2330/3.0-patch3
Fixed Connection closed when exporting a running project
2025-11-04 04:07:01 +01:00
Bine
d5f360c176 Update projects.py 2025-10-18 19:28:15 +02:00
Bine
e817228280 Fix non-ASCII characters in project names 2025-10-18 18:10:24 +02:00
grossmj
aa8ccf4f82
Allow an image to be uploaded to the controller again even if it is already in the database 2025-04-17 19:07:22 +07:00
grossmj
5019167098
Fix interface information API endpoint for Cloud/NAT devices 2025-04-16 15:26:56 +07:00
Mark Paronyan
bab173ee52
feat(get_iface): add type information in response 2025-03-23 14:28:27 +00:00
Mark Paronyan
ea2856289a
feat: add endpoint to get iface/udp tunnel from links with Cloud,Nat 2025-03-23 13:46:27 +00:00
grossmj
ee9f974362
Fix packet capture for links connected to a cloud node. Fixes #2513 2025-03-16 21:12:33 +07:00
grossmj
0c3f6712b4
Fix auto idle-pc for IOS templates 2025-02-22 20:14:13 +10:00
grossmj
035a104957
Fix capture on IOU/IOL links. Fixes #2477 2025-01-11 18:46:55 +07:00
grossmj
08693871ae
Support to create templates based on image checksums. 2025-01-03 21:35:14 +07:00
grossmj
4758431c76
Improvements for built-in disks
* Checksum is updated in the database for updated disks.
* It is not possible to prune them.
2025-01-02 23:10:51 +07:00
grossmj
7229707746
Use static favicon for API docs. Ref #3674 2024-12-19 17:25:42 +07:00
grossmj
0ee73605c0
Configure self-hosting JavaScript and CSS for docs 2024-12-19 16:54:11 +07:00
grossmj
4e41aefbdb
Require "Project.Audit" permission to duplicate a project and check if "Project.Allocate" permission for the destination. 2024-12-06 14:09:08 +10:00
grossmj
a00f53fbaa
Fix error 500 on PUT for cloud, nat, vmware and vpcs nodes. Fixes #2426 2024-11-19 12:21:35 +10:00
grossmj
e83e12b51a
Add a duplicated project in the same resource pools as the original project if it is in any 2024-11-17 14:03:47 +10:00
grossmj
ce4dd17409
Upgrade fastapi and fix tests 2024-10-31 19:23:28 +10:00
grossmj
a1666dd247
Fix MAC address support for Docker containers 2024-09-18 18:02:35 +07:00
grossmj
6b14abc06f
Add allow_unsafe_options for Qemu settings 2024-07-07 19:08:12 +02:00
grossmj
8c1dbf0084
Fix to allow duplicating IOS routers 2024-05-19 00:33:55 +07:00
grossmj
38df4bea2e
Do not return an error if an image has already been uploaded 2024-04-26 19:02:50 +07:00
grossmj
31c7fe88f1
Remove websocket.close() 2024-03-16 16:00:27 +01:00
grossmj
37f720ac73 Fix bug when listing endpoints for opened project 2023-11-23 15:38:42 +10:00
grossmj
61dede72f9 Fix ws console and packet capture over SSL 2023-11-03 15:35:49 +10:00
grossmj
44c066ac68 Fix compute authentication for websocket endpoints 2023-10-22 12:44:39 +10:00
grossmj
47d3f3f349 Do not enforce Compute.Audit and Template.Audit privileges due to current web-ui limitations 2023-10-18 15:51:43 +10:00
grossmj
5092bd2fdf List elements when a project is closed 2023-10-09 13:16:12 +10:00