feat(copilot): add copilot_mode field to LLM model configs API

- Add `copilot_mode` field to request examples in API documentation
- Update prompt loader to read `copilot_mode` from flattened config structure
- Support both "teaching" and "lab_assistant" modes for different assistant behaviors
This commit is contained in:
YueGuobin 2026-03-05 16:41:47 +08:00
parent a777c36a29
commit 08b5b44a50
2 changed files with 8 additions and 4 deletions

View File

@ -235,6 +235,7 @@ curl -X POST http://localhost:3080/v3/access/users/{user_id}/llm-model-configs \
"context_limit": 128,
"context_strategy": "balanced",
"api_key": "sk-xxx",
"copilot_mode": "teaching",
"is_default": true
}'
```
@ -284,6 +285,7 @@ curl -X POST http://localhost:3080/v3/access/groups/{group_id}/llm-model-configs
"context_limit": 200,
"context_strategy": "balanced",
"api_key": "sk-ant-xxx",
"copilot_mode": "lab_assistant",
"is_default": true
}'
```
@ -535,7 +537,8 @@ curl -X GET http://localhost:3080/v3/access/users/{user_id}/llm-model-configs/de
"temperature": 0.7,
"context_limit": 128,
"context_strategy": "balanced",
"api_key": "sk-xxx"
"api_key": "sk-xxx",
"copilot_mode": null
},
"user_id": "uuid-user",
"group_id": null,

View File

@ -51,7 +51,7 @@ def load_system_prompt(llm_config: dict | None = None) -> str:
- "lab_assistant": Full lab assistant mode - diagnostics and configuration enabled
Args:
llm_config: LLM model configuration dictionary containing the config field
llm_config: LLM model configuration dictionary (flattened structure from get_user_llm_config_full)
Returns:
str: The system prompt string.
@ -60,8 +60,9 @@ def load_system_prompt(llm_config: dict | None = None) -> str:
logger.info("No LLM config provided, using default TEACHING assistant prompt mode")
return SYSTEM_PROMPT
config = llm_config.get("config", {})
mode = config.get("copilot_mode", "teaching").lower()
# llm_config is a flattened dict with copilot_mode at the top level
# Example: {"provider": "...", "model": "...", "copilot_mode": "...", ...}
mode = llm_config.get("copilot_mode", "teaching").lower()
if mode == "lab_assistant":
logger.info("Using LAB_ASSISTANT prompt mode (diagnostics + configuration)")