Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: bandit

Bingxi Zhao563ceb7724c4
diff --git a/src/agents/question/agents/generate_agent.py b/src/agents/question/agents/generate_agent.py
index 341112e6f..8dcb1996c 100644
--- a/src/agents/question/agents/generate_agent.py
+++ b/src/agents/question/agents/generate_agent.py
@@ -16,7 +16,7 @@ from src.agents.base_agent import BaseAgent
class GenerateAgent(BaseAgent):
"""
Agent responsible for generating questions from knowledge context.
-
+
Responsibilities:
- Generate questions based on requirements and knowledge
- Support both custom mode (from scratch) and mimic mode (from reference)
@@ -68,7 +68,7 @@ class GenerateAgent(BaseAgent):
# Build requirements string
requirements_str = json.dumps(requirement, ensure_ascii=False, indent=2)
-
+
# Build focus string
if focus:
focus_str = f"Focus: {focus.get('focus', '')}\nType: {focus.get('type', requirement.get('question_type', 'written'))}"
@@ -127,7 +127,9 @@ class GenerateAgent(BaseAgent):
user_prompt = user_prompt_template.format(
requirements=requirements_str,
focus=focus_str,
- knowledge=knowledge_context[:4000] if len(knowledge_context) > 4000 else knowledge_context,
+ knowledge=knowledge_context[:4000]
+ if len(knowledge_context) > 4000
+ else knowledge_context,
)
try:
@@ -188,7 +190,9 @@ class GenerateAgent(BaseAgent):
user_prompt = user_prompt_template.format(
reference_question=reference_question,
requirements=requirements_str,
- knowledge=knowledge_context[:4000] if len(knowledge_context) > 4000 else knowledge_context,
+ knowledge=knowledge_context[:4000]
+ if len(knowledge_context) > 4000
+ else knowledge_context,
)
try:
@@ -375,4 +379,3 @@ class GenerateAgent(BaseAgent):
# If no code blocks found, return as-is (might already be valid JSON)
return content.strip()
-
diff --git a/src/agents/question/agents/relevance_analyzer.py b/src/agents/question/agents/relevance_analyzer.py
index 00c65fb60..b366257d2 100644
--- a/src/agents/question/agents/relevance_analyzer.py
+++ b/src/agents/question/agents/relevance_analyzer.py
@@ -17,12 +17,12 @@ from src.agents.base_agent import BaseAgent
class RelevanceAnalyzer(BaseAgent):
"""
Agent responsible for analyzing question-knowledge relevance.
-
+
Key difference from old ValidationWorkflow:
- NO rejection: all questions are accepted
- NO iteration: single-pass analysis
- Output: relevance level (high/partial) with explanations
-
+
Responsibilities:
- Analyze how well a question aligns with knowledge base content
- Identify what KB concepts the question tests
@@ -170,7 +170,9 @@ class RelevanceAnalyzer(BaseAgent):
return {
"relevance": relevance,
"kb_coverage": result.get("kb_coverage", ""),
- "extension_points": result.get("extension_points", "") if relevance == "partial" else "",
+ "extension_points": result.get("extension_points", "")
+ if relevance == "partial"
+ else "",
}
def _clean_json_string(self, json_str: str) -> str:
@@ -203,4 +205,3 @@ class RelevanceAnalyzer(BaseAgent):
return matches[0].strip()
return content.strip()
-
diff --git a/src/agents/question/agents/retrieve_agent.py b/src/agents/question/agents/retrieve_agent.py
index ee1f50191..544a81195 100644
--- a/src/agents/question/agents/retrieve_agent.py
+++ b/src/agents/question/agents/retrieve_agent.py
@@ -17,7 +17,7 @@ from src.tools.rag_tool import rag_search
class RetrieveAgent(BaseAgent):
"""
Agent responsible for knowledge retrieval from the knowledge base.
-
+
Responsibilities:
- Generate semantic search queries from requirements
- Execute RAG searches in parallel
@@ -110,13 +110,13 @@ class RetrieveAgent(BaseAgent):
"""
system_prompt = self.get_prompt("system", "")
user_prompt_template = self.get_prompt("generate_queries", "")
-
+
if not user_prompt_template:
# Fallback prompt
user_prompt_template = (
f"Extract {num_queries} knowledge point names from this requirement for retrieval:\n"
"{requirement_text}\n\n"
- "Return JSON: {{\"queries\": [\"point1\", \"point2\", ...]}}"
+ 'Return JSON: {{"queries": ["point1", "point2", ...]}}'
)
user_prompt = user_prompt_template.format(
@@ -237,4 +237,3 @@ class RetrieveAgent(BaseAgent):
lines.append("")
return "\n".join(lines)
-
diff --git a/src/agents/question/prompts/en/generate_agent.yaml b/src/agents/question/prompts/en/generate_agent.yaml
index b6a6482ad..968e56818 100644
--- a/src/agents/question/prompts/en/generate_agent.yaml
+++ b/src/agents/question/prompts/en/generate_agent.yaml
@@ -75,4 +75,3 @@ generate_with_reference: |
"correct_answer": "correct answer",
"explanation": "detailed explanation"
}}
-
diff --git a/src/agents/question/prompts/en/relevance_analyzer.yaml b/src/agents/question/prompts/en/relevance_analyzer.yaml
index adc69bca1..846dd5bf0 100644
--- a/src/agents/question/prompts/en/relevance_analyzer.yaml
+++ b/src/agents/question/prompts/en/relevance_analyzer.yaml
@@ -1,7 +1,7 @@
system: |
- You are an educational content analyst specializing in analyzing the relationship
+ You are an educational content analyst specializing in analyzing the relationship
between exam questions and knowledge base content.
-
+
Your task is to analyze the relevance between a question and the knowledge base,
NOT to validate or reject the question. All questions are accepted.
@@ -39,4 +39,3 @@ analyze_relevance: |
Your response must start with {{ and end with }}.
Output only the JSON, no additional text.
-
diff --git a/src/agents/question/prompts/en/retrieve_agent.yaml b/src/agents/question/prompts/en/retrieve_agent.yaml
index 4e72e6357..04bba6047 100644
--- a/src/agents/question/prompts/en/retrieve_agent.yaml
+++ b/src/agents/question/prompts/en/retrieve_agent.yaml
@@ -1,33 +1,32 @@
system: |
You are a knowledge base retrieval assistant, preparing for question generation.
-
- Your task is to generate knowledge point retrieval queries to find theoretical explanations,
+
+ Your task is to generate knowledge point retrieval queries to find theoretical explanations,
definitions, and theorems in the knowledge base.
-
- Key principle: You are NOT generating questions now! You are looking for theoretical knowledge
+
+ Key principle: You are NOT generating questions now! You are looking for theoretical knowledge
needed for question generation.
generate_queries: |
The user's question generation requirement is:
{requirement_text}
-
+
Please extract {num_queries} pure knowledge point names for knowledge base retrieval.
-
+
Output Rules:
1. Only output pure knowledge point names (theorem names, concept names, method names)
2. Each query should be 2-5 words
3. Do not include functions, numerical values, or calculation tasks
4. Do not use questions or task descriptions
-
+
Correct examples:
✓ Taylor theorem
- ✓ Lagrange multipliers
+ ✓ Lagrange multipliers
✓ critical points
-
+
Incorrect examples (do not generate):
✗ Apply Taylor's Theorem to approximate f(x,y)=... (This is a question)
✗ Find and classify critical points (This is a task)
✗ Use Lagrange multipliers to find maximum (This is an instruction)
-
- Return in JSON format: {{"queries": ["knowledge point 1", "knowledge point 2", ...]}}, containing exactly {num_queries} knowledge point names.
+ Return in JSON format: {{"queries": ["knowledge point 1", "knowledge point 2", ...]}}, containing exactly {num_queries} knowledge point names.
diff --git a/src/agents/question/prompts/zh/generate_agent.yaml b/src/agents/question/prompts/zh/generate_agent.yaml
index 435afb012..691a2fb7a 100644
--- a/src/agents/question/prompts/zh/generate_agent.yaml
+++ b/src/agents/question/prompts/zh/generate_agent.yaml
@@ -75,4 +75,3 @@ generate_with_reference: |
"correct_answer": "正确答案",
"explanation": "详细解释"
}}
-
diff --git a/src/agents/question/prompts/zh/relevance_analyzer.yaml b/src/agents/question/prompts/zh/relevance_analyzer.yaml
index 93fa3395d..1ebba0cef 100644
--- a/src/agents/question/prompts/zh/relevance_analyzer.yaml
+++ b/src/agents/question/prompts/zh/relevance_analyzer.yaml
@@ -1,6 +1,6 @@
system: |
你是一位教育内容分析师,专门分析考试题目与知识库内容之间的关系。
-
+
你的任务是分析题目与知识库的相关性,而不是验证或拒绝题目。所有题目都被接受。
analyze_relevance: |
@@ -37,4 +37,3 @@ analyze_relevance: |
你的回复必须以 {{ 开始,以 }} 结束。
只输出 JSON,不要有其他文字。
-
diff --git a/src/agents/question/prompts/zh/retrieve_agent.yaml b/src/agents/question/prompts/zh/retrieve_agent.yaml
index adbce15b5..02da5bb1f 100644
--- a/src/agents/question/prompts/zh/retrieve_agent.yaml
+++ b/src/agents/question/prompts/zh/retrieve_agent.yaml
@@ -1,31 +1,30 @@
system: |
你是一个知识库检索助手,正在为题目生成做准备。
-
+
你的任务是生成知识点检索查询,以在知识库中找到理论解释、定义和定理。
-
+
关键原则:你现在不是在生成题目!你是在寻找题目生成所需的理论知识。
generate_queries: |
用户的题目生成需求是:
{requirement_text}
-
+
请提取 {num_queries} 个纯粹的知识点名称用于知识库检索。
-
+
输出规则:
1. 只输出纯粹的知识点名称(定理名、概念名、方法名)
2. 每个查询应为2-5个词
3. 不要包含函数、数值或计算任务
4. 不要使用问句或任务描述
-
+
正确示例:
✓ 泰勒定理
- ✓ 拉格朗日乘数法
+ ✓ 拉格朗日乘数法
✓ 临界点
-
+
错误示例(不要生成):
✗ 应用泰勒定理近似 f(x,y)=... (这是一个题目)
✗ 找出并分类临界点 (这是一个任务)
✗ 使用拉格朗日乘数法求最大值 (这是一个指令)
-
- 以 JSON 格式返回:{{"queries": ["知识点1", "知识点2", ...]}}, 包含恰好 {num_queries} 个知识点名称。
+ 以 JSON 格式返回:{{"queries": ["知识点1", "知识点2", ...]}}, 包含恰好 {num_queries} 个知识点名称。
diff --git a/src/api/routers/config.py b/src/api/routers/config.py
index 76589441a..c77c13456 100644
--- a/src/api/routers/config.py
+++ b/src/api/routers/config.py
@@ -10,7 +10,7 @@ Provides REST API for managing configurations for:
"""
import os
-from typing import Any, Dict, List, Literal, Optional
+from typing import Any, Dict, Literal, Optional
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel, Field
@@ -19,22 +19,28 @@ from src.services.config import (
ConfigType,
get_config_manager,
)
-from src.services.llm import complete as llm_complete, sanitize_url
+from src.services.llm import complete as llm_complete
+from src.services.llm import sanitize_url
router = APIRouter()
# ==================== Request/Response Models ====================
+
class ConfigBase(BaseModel):
"""Base configuration model."""
+
name: str = Field(..., description="Display name for this configuration")
provider: str = Field(..., description="Provider type")
class LLMConfigCreate(ConfigBase):
"""LLM configuration for creation."""
- base_url: str | Dict[str, str] = Field(..., description="API endpoint or {'use_env': 'VAR_NAME'}")
+
+ base_url: str | Dict[str, str] = Field(
+ ..., description="API endpoint or {'use_env': 'VAR_NAME'}"
+ )
api_key: str | Dict[str, str] = Field(..., description="API key or {'use_env': 'VAR_NAME'}")
model: str = Field(..., description="Model name")
api_version: Optional[str] = None
@@ -42,6 +48,7 @@ class LLMConfigCreate(ConfigBase):
class EmbeddingConfigCreate(ConfigBase):
"""Embedding configuration for creation."""
+
base_url: str | Dict[str, str]
api_key: str | Dict[str, str]
model: str
@@ -51,6 +58,7 @@ class EmbeddingConfigCreate(ConfigBase):
class TTSConfigCreate(ConfigBase):
"""TTS configuration for creation."""
+
base_url: str | Dict[str, str]
api_key: str | Dict[str, str]
model: str
@@ -60,14 +68,18 @@ class TTSConfigCreate(ConfigBase):
class SearchConfigCreate(ConfigBase):
"""Search configuration for creation.
-
+
Uses unified SEARCH_API_KEY environment variable.
"""
- api_key: str | Dict[str, str] = Field(..., description="API key or {'use_env': 'SEARCH_API_KEY'}")
+
+ api_key: str | Dict[str, str] = Field(
+ ..., description="API key or {'use_env': 'SEARCH_API_KEY'}"
+ )
class ConfigUpdate(BaseModel):
"""Configuration update model."""
+
name: Optional[str] = None
provider: Optional[str] = None
base_url: Optional[str | Dict[str, str]] = None
@@ -80,16 +92,18 @@ class ConfigUpdate(BaseModel):
class SetActiveRequest(BaseModel):
"""Request to set active configuration."""
+
config_id: str
class TestConnectionRequest(BaseModel):
"""Request to test a connection.
-
+
base_url and api_key can be either:
- A string value
- A dict with {"use_env": "VAR_NAME"} to load from environment
"""
+
provider: str
base_url: str | Dict[str, str]
api_key: str | Dict[str, str]
@@ -101,7 +115,7 @@ class TestConnectionRequest(BaseModel):
def resolve_env_value(value: str | Dict[str, str], fallback: str = "") -> str:
"""
Resolve a value that may be a string or {"use_env": "VAR_NAME"}.
-
+
If value is a dict with use_env, fetch from environment variable.
Otherwise return the string value directly.
"""
@@ -113,6 +127,7 @@ def resolve_env_value(value: str | Dict[str, str], fallback: str = "") -> str:
class ConfigStatusResponse(BaseModel):
"""Response for configuration status."""
+
llm: Dict[str, Any]
embedding: Dict[str, Any]
tts: Dict[str, Any]
@@ -121,12 +136,14 @@ class ConfigStatusResponse(BaseModel):
class PortsResponse(BaseModel):
"""Response for port configuration."""
+
backend_port: int
frontend_port: int
# ==================== Status Endpoints ====================
+
@router.get("/status", response_model=ConfigStatusResponse)
async def get_config_status():
"""
@@ -134,15 +151,17 @@ async def get_config_status():
Shows which service has active configuration and what it is.
"""
manager = get_config_manager()
-
+
def get_status(config_type: ConfigType) -> Dict[str, Any]:
active = manager.get_active_config(config_type)
env_status = manager.get_env_status(config_type)
configs = manager.list_configs(config_type)
active_config = next((c for c in configs if c.get("is_active")), None)
-
+
return {
- "configured": bool(active and active.get("model" if config_type != ConfigType.SEARCH else "provider")),
+ "configured": bool(
+ active and active.get("model" if config_type != ConfigType.SEARCH else "provider")
+ ),
"active_config_id": active_config.get("id") if active_config else "default",
"active_config_name": active_config.get("name") if active_config else "Default",
"model": active.get("model") if active else None,
@@ -150,7 +169,7 @@ async def get_config_status():
"env_configured": env_status,
"total_configs": len(configs),
}
-
+
return ConfigStatusResponse(
llm=get_status(ConfigType.LLM),
embedding=get_status(ConfigType.EMBEDDING),
@@ -178,6 +197,7 @@ async def get_providers(config_type: Literal["llm", "embedding", "tts", "search"
# ==================== LLM Configuration Endpoints ====================
+
@router.get("/llm")
async def list_llm_configs():
"""List all LLM configurations."""
@@ -199,7 +219,7 @@ async def update_llm_config(config_id: str, updates: ConfigUpdate):
"""Update an LLM configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot update default configuration")
-
+
manager = get_config_manager()
result = manager.update_config(ConfigType.LLM, config_id, updates.model_dump(exclude_none=True))
if not result:
@@ -212,7 +232,7 @@ async def delete_llm_config(config_id: str):
"""Delete an LLM configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot delete default configuration")
-
+
manager = get_config_manager()
success = manager.delete_config(ConfigType.LLM, config_id)
if not success:
@@ -237,16 +257,16 @@ async def test_llm_connection(request: TestConnectionRequest):
# Resolve use_env references to actual values
base_url = resolve_env_value(request.base_url)
api_key = resolve_env_value(request.api_key)
-
+
# Validate required fields
if not base_url:
return {"success": False, "message": "Base URL is required"}
if not request.model:
return {"success": False, "message": "Model name is required"}
-
+
base_url = sanitize_url(base_url)
api_key = api_key or "sk-no-key-required"
-
+
response = await llm_complete(
model=request.model,
prompt="Hello, are you working?",
@@ -266,7 +286,7 @@ async def test_llm_config_by_id(config_id: str):
"""Test connection for an existing LLM configuration by ID."""
try:
manager = get_config_manager()
-
+
if config_id == "default":
# Get default config from env
config = manager.get_default_config(ConfigType.LLM)
@@ -278,15 +298,15 @@ async def test_llm_config_by_id(config_id: str):
return {"success": False, "message": f"Configuration '{config_id}' not found"}
# Resolve use_env references for user configs
config = manager.resolve_config_env_values(config)
-
+
if not config or not config.get("base_url"):
return {"success": False, "message": "Configuration is incomplete (missing base_url)"}
-
+
base_url = sanitize_url(config.get("base_url", ""))
api_key = config.get("api_key") or "sk-no-key-required"
model = config.get("model", "")
provider = config.get("provider", "openai")
-
+
response = await llm_complete(
model=model,
prompt="Hello, are you working?",
@@ -303,6 +323,7 @@ async def test_llm_config_by_id(config_id: str):
# ==================== Embedding Configuration Endpoints ====================
+
@router.get("/embedding")
async def list_embedding_configs():
"""List all embedding configurations."""
@@ -324,9 +345,11 @@ async def update_embedding_config(config_id: str, updates: ConfigUpdate):
"""Update an embedding configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot update default configuration")
-
+
manager = get_config_manager()
- result = manager.update_config(ConfigType.EMBEDDING, config_id, updates.model_dump(exclude_none=True))
+ result = manager.update_config(
+ ConfigType.EMBEDDING, config_id, updates.model_dump(exclude_none=True)
+ )
if not result:
raise HTTPException(status_code=404, detail="Configuration not found")
return result
@@ -337,7 +360,7 @@ async def delete_embedding_config(config_id: str):
"""Delete an embedding configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot delete default configuration")
-
+
manager = get_config_manager()
success = manager.delete_config(ConfigType.EMBEDDING, config_id)
if not success:
@@ -361,11 +384,11 @@ async def test_embedding_connection(request: TestConnectionRequest):
try:
from src.services.embedding.client import EmbeddingClient
from src.services.embedding.config import EmbeddingConfig
-
+
# Resolve use_env references
base_url = resolve_env_value(request.base_url)
api_key = resolve_env_value(request.api_key)
-
+
# Validate required fields
if not base_url:
return {"success": False, "message": "Base URL is required"}
@@ -373,7 +396,7 @@ async def test_embedding_connection(request: TestConnectionRequest):
return {"success": False, "message": "Model name is required"}
if not request.dimensions:
return {"success": False, "message": "Dimensions is required for embedding models"}
-
+
# Create a test config with dimensions
test_config = EmbeddingConfig(
model=request.model,
@@ -382,7 +405,7 @@ async def test_embedding_connection(request: TestConnectionRequest):
binding=request.provider,
dim=request.dimensions,
)
-
+
# Create a temporary client for testing
client = EmbeddingClient(test_config)
# Use embed() method with a list of texts
@@ -400,9 +423,9 @@ async def test_embedding_config_by_id(config_id: str):
try:
from src.services.embedding.client import EmbeddingClient
from src.services.embedding.config import EmbeddingConfig
-
+
manager = get_config_manager()
-
+
if config_id == "default":
config = manager.get_default_config(ConfigType.EMBEDDING)
else:
@@ -411,10 +434,10 @@ async def test_embedding_config_by_id(config_id: str):
if not config:
return {"success": False, "message": f"Configuration '{config_id}' not found"}
config = manager.resolve_config_env_values(config)
-
+
if not config or not config.get("base_url"):
return {"success": False, "message": "Configuration is incomplete (missing base_url)"}
-
+
# Create a test config
test_config = EmbeddingConfig(
model=config.get("model", ""),
@@ -423,7 +446,7 @@ async def test_embedding_config_by_id(config_id: str):
binding=config.get("provider", "openai"),
dim=config.get("dimensions", 3072),
)
-
+
# Create a temporary client for testing
client = EmbeddingClient(test_config)
# Use embed() method with a list of texts
@@ -437,6 +460,7 @@ async def test_embedding_config_by_id(config_id: str):
# ==================== TTS Configuration Endpoints ====================
+
@router.get("/tts")
async def list_tts_configs():
"""List all TTS configurations."""
@@ -458,7 +482,7 @@ async def update_tts_config(config_id: str, updates: ConfigUpdate):
"""Update a TTS configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot update default configuration")
-
+
manager = get_config_manager()
result = manager.update_config(ConfigType.TTS, config_id, updates.model_dump(exclude_none=True))
if not result:
@@ -471,7 +495,7 @@ async def delete_tts_config(config_id: str):
"""Delete a TTS configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot delete default configuration")
-
+
manager = get_config_manager()
success = manager.delete_config(ConfigType.TTS, config_id)
if not success:
@@ -494,17 +518,17 @@ async def test_tts_connection(request: TestConnectionRequest):
"""Test connection to a TTS provider."""
try:
from openai import AsyncOpenAI
-
+
# Resolve use_env references
base_url = resolve_env_value(request.base_url)
api_key = resolve_env_value(request.api_key)
-
+
# Validate required fields
if not base_url:
return {"success": False, "message": "Base URL is required"}
if not request.model:
return {"success": False, "message": "Model name is required"}
-
+
# Test by creating client and checking if we can reach the API
client = AsyncOpenAI(
api_key=api_key or "sk-no-key-required",
@@ -521,9 +545,9 @@ async def test_tts_config_by_id(config_id: str):
"""Test connection for an existing TTS configuration by ID."""
try:
from openai import AsyncOpenAI
-
+
manager = get_config_manager()
-
+
if config_id == "default":
config = manager.get_default_config(ConfigType.TTS)
else:
@@ -532,10 +556,10 @@ async def test_tts_config_by_id(config_id: str):
if not config:
return {"success": False, "message": f"Configuration '{config_id}' not found"}
config = manager.resolve_config_env_values(config)
-
+
if not config or not config.get("base_url"):
return {"success": False, "message": "Configuration is incomplete (missing base_url)"}
-
+
# Test by creating client
client = AsyncOpenAI(
api_key=config.get("api_key") or "sk-no-key-required",
@@ -548,6 +572,7 @@ async def test_tts_config_by_id(config_id: str):
# ==================== Search Configuration Endpoints ====================
+
@router.get("/search")
async def list_search_configs():
"""List all search configurations."""
@@ -569,9 +594,11 @@ async def update_search_config(config_id: str, updates: ConfigUpdate):
"""Update a search configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot update default configuration")
-
+
manager = get_config_manager()
- result = manager.update_config(ConfigType.SEARCH, config_id, updates.model_dump(exclude_none=True))
+ result = manager.update_config(
+ ConfigType.SEARCH, config_id, updates.model_dump(exclude_none=True)
+ )
if not result:
raise HTTPException(status_code=404, detail="Configuration not found")
return result
@@ -582,7 +609,7 @@ async def delete_search_config(config_id: str):
"""Delete a search configuration."""
if config_id == "default":
raise HTTPException(status_code=400, detail="Cannot delete default configuration")
-
+
manager = get_config_manager()
success = manager.delete_config(ConfigType.SEARCH, config_id)
if not success:
@@ -598,4 +625,3 @@ async def set_active_search_config(config_id: str):
if not success:
raise HTTPException(status_code=404, detail="Configuration not found")
return {"message": "Configuration activated", "active_id": config_id}
-
diff --git a/src/services/config/unified_config.py b/src/services/config/unified_config.py
index 787b494bb..a79865e06 100644
--- a/src/services/config/unified_config.py
+++ b/src/services/config/unified_config.py
@@ -6,13 +6,13 @@ Manages configurations for LLM, Embedding, TTS, and Search services.
Supports both .env defaults and user-defined configurations.
"""
+from enum import Enum
import json
import logging
import os
-import uuid
-from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional
+import uuid
from dotenv import load_dotenv
@@ -29,6 +29,7 @@ SETTINGS_DIR = PROJECT_ROOT / "data" / "user" / "settings"
class ConfigType(str, Enum):
"""Configuration types."""
+
LLM = "llm"
EMBEDDING = "embedding"
TTS = "tts"
@@ -37,7 +38,15 @@ class ConfigType(str, Enum):
# Provider options for each service type
PROVIDER_OPTIONS = {
- ConfigType.LLM: ["openai", "anthropic", "azure_openai", "deepseek", "ollama", "lm_studio", "vllm"],
+ ConfigType.LLM: [
+ "openai",
+ "anthropic",
+ "azure_openai",
+ "deepseek",
+ "ollama",
+ "lm_studio",
+ "vllm",
+ ],
ConfigType.EMBEDDING: ["openai", "azure_openai", "ollama", "jina", "cohere", "huggingface"],
ConfigType.TTS: ["openai", "azure_openai"],
ConfigType.SEARCH: ["perplexity", "tavily", "exa", "jina", "serper", "baidu"],
@@ -78,7 +87,7 @@ ENV_VAR_MAPPINGS = {
def _resolve_env_value(value: Any) -> Any:
"""
Resolve a value that may reference an environment variable.
-
+
If value is {"use_env": "VAR_NAME"}, returns os.environ.get("VAR_NAME").
Otherwise, returns the value as-is.
"""
@@ -99,32 +108,32 @@ def _get_env_value(env_var: str) -> Optional[str]:
class UnifiedConfigManager:
"""
Manages configurations for all service types.
-
+
Each service type has:
- A "default" configuration that comes from .env (cannot be deleted)
- User-defined configurations that can be added/edited/deleted
- An "active" configuration that is currently in use
"""
-
+
_instance: Optional["UnifiedConfigManager"] = None
-
+
def __new__(cls):
if cls._instance is None:
cls._instance = super(UnifiedConfigManager, cls).__new__(cls)
cls._instance._initialized = False
return cls._instance
-
+
def __init__(self):
if getattr(self, "_initialized", False):
return
-
+
SETTINGS_DIR.mkdir(parents=True, exist_ok=True)
self._initialized = True
-
+
def _get_storage_path(self, config_type: ConfigType) -> Path:
"""Get the storage file path for a config type."""
return SETTINGS_DIR / f"{config_type.value}_configs.json"
-
+
def _load_configs(self, config_type: ConfigType) -> Dict[str, Any]:
"""Load configurations from storage."""
path = self._get_storage_path(config_type)
@@ -135,7 +144,7 @@ class UnifiedConfigManager:
except (json.JSONDecodeError, IOError) as e:
logger.warning(f"Failed to load {config_type.value} configs: {e}")
return {"configs": [], "active_id": "default"}
-
+
def _save_configs(self, config_type: ConfigType, data: Dict[str, Any]) -> bool:
"""Save configurations to storage."""
path = self._get_storage_path(config_type)
@@ -146,11 +155,11 @@ class UnifiedConfigManager:
except IOError as e:
logger.error(f"Failed to save {config_type.value} configs: {e}")
return False
-
+
def _build_default_config(self, config_type: ConfigType) -> Dict[str, Any]:
"""Build the default configuration from environment variables."""
env_mapping = ENV_VAR_MAPPINGS.get(config_type, {})
-
+
if config_type == ConfigType.LLM:
return {
"id": "default",
@@ -162,7 +171,7 @@ class UnifiedConfigManager:
"model": _get_env_value(env_mapping.get("model")) or "",
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.EMBEDDING:
dim_str = _get_env_value(env_mapping.get("dimensions"))
return {
@@ -176,7 +185,7 @@ class UnifiedConfigManager:
"dimensions": int(dim_str) if dim_str and dim_str.isdigit() else 3072,
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.TTS:
return {
"id": "default",
@@ -189,7 +198,7 @@ class UnifiedConfigManager:
"voice": _get_env_value(env_mapping.get("voice")) or "alloy",
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.SEARCH:
provider = _get_env_value(env_mapping.get("provider")) or "perplexity"
return {
@@ -199,13 +208,13 @@ class UnifiedConfigManager:
"provider": provider,
"api_key": "***",
}
-
+
return {"id": "default", "name": "Default (from .env)", "is_default": True}
-
+
def _get_default_config_resolved(self, config_type: ConfigType) -> Dict[str, Any]:
"""Get the default configuration with actual values resolved (for internal use)."""
env_mapping = ENV_VAR_MAPPINGS.get(config_type, {})
-
+
if config_type == ConfigType.LLM:
return {
"id": "default",
@@ -215,7 +224,7 @@ class UnifiedConfigManager:
"model": _get_env_value(env_mapping.get("model")) or "",
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.EMBEDDING:
dim_str = _get_env_value(env_mapping.get("dimensions"))
return {
@@ -227,7 +236,7 @@ class UnifiedConfigManager:
"dimensions": int(dim_str) if dim_str and dim_str.isdigit() else 3072,
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.TTS:
return {
"id": "default",
@@ -238,7 +247,7 @@ class UnifiedConfigManager:
"voice": _get_env_value(env_mapping.get("voice")) or "alloy",
"api_version": _get_env_value(env_mapping.get("api_version")),
}
-
+
elif config_type == ConfigType.SEARCH:
provider = _get_env_value(env_mapping.get("provider")) or "perplexity"
return {
@@ -246,60 +255,60 @@ class UnifiedConfigManager:
"provider": provider,
"api_key": _get_env_value(env_mapping.get("api_key")) or "",
}
-
+
return {"id": "default"}
-
+
def _resolve_config(self, config: Dict[str, Any], config_type: ConfigType) -> Dict[str, Any]:
"""Resolve all {"use_env": ...} references in a configuration."""
resolved = {}
env_mapping = ENV_VAR_MAPPINGS.get(config_type, {})
-
+
for key, value in config.items():
if isinstance(value, dict) and "use_env" in value:
env_var = value["use_env"]
resolved[key] = _get_env_value(env_var) or ""
else:
resolved[key] = value
-
+
return resolved
-
+
def get_provider_options(self, config_type: ConfigType) -> List[str]:
"""Get available provider options for a config type."""
return PROVIDER_OPTIONS.get(config_type, [])
-
+
def list_configs(self, config_type: ConfigType) -> List[Dict[str, Any]]:
"""
List all configurations for a service type.
Includes the default config (from .env) and user-defined configs.
"""
data = self._load_configs(config_type)
-
+
# Build default config
default_config = self._build_default_config(config_type)
-
+
# Get user configs
user_configs = data.get("configs", [])
-
+
# Mark active config
active_id = data.get("active_id", "default")
-
+
all_configs = [default_config] + user_configs
for cfg in all_configs:
cfg["is_active"] = cfg.get("id") == active_id
-
+
return all_configs
-
+
def get_config(self, config_type: ConfigType, config_id: str) -> Optional[Dict[str, Any]]:
"""Get a specific configuration by ID."""
if config_id == "default":
return self._build_default_config(config_type)
-
+
data = self._load_configs(config_type)
for cfg in data.get("configs", []):
if cfg.get("id") == config_id:
return cfg
return None
-
+
def get_active_config(self, config_type: ConfigType) -> Optional[Dict[str, Any]]:
"""
Get the currently active configuration with all values resolved.
@@ -307,41 +316,43 @@ class UnifiedConfigManager:
"""
data = self._load_configs(config_type)
active_id = data.get("active_id", "default")
-
+
if active_id == "default":
return self._get_default_config_resolved(config_type)
-
+
for cfg in data.get("configs", []):
if cfg.get("id") == active_id:
return self._resolve_config(cfg, config_type)
-
+
# Fallback to default if active config not found
return self._get_default_config_resolved(config_type)
-
+
def add_config(self, config_type: ConfigType, config: Dict[str, Any]) -> Dict[str, Any]:
"""Add a new configuration."""
data = self._load_configs(config_type)
-
+
# Generate ID if not provided
if "id" not in config:
config["id"] = str(uuid.uuid4())[:8]
-
+
# Ensure required fields
config["is_default"] = False
-
+
# Add to list
data["configs"].append(config)
self._save_configs(config_type, data)
-
+
return config
-
- def update_config(self, config_type: ConfigType, config_id: str, updates: Dict[str, Any]) -> Optional[Dict[str, Any]]:
+
+ def update_config(
+ self, config_type: ConfigType, config_id: str, updates: Dict[str, Any]
+ ) -> Optional[Dict[str, Any]]:
"""Update an existing configuration."""
if config_id == "default":
return None # Cannot update default config
-
+
data = self._load_configs(config_type)
-
+
for i, cfg in enumerate(data.get("configs", [])):
if cfg.get("id") == config_id:
# Update fields
@@ -351,58 +362,58 @@ class UnifiedConfigManager:
data["configs"][i] = cfg
self._save_configs(config_type, data)
return cfg
-
+
return None
-
+
def delete_config(self, config_type: ConfigType, config_id: str) -> bool:
"""Delete a configuration."""
if config_id == "default":
return False # Cannot delete default config
-
+
data = self._load_configs(config_type)
original_len = len(data.get("configs", []))
data["configs"] = [c for c in data.get("configs", []) if c.get("id") != config_id]
-
+
if len(data["configs"]) < original_len:
# If deleted config was active, switch to default
if data.get("active_id") == config_id:
data["active_id"] = "default"
self._save_configs(config_type, data)
return True
-
+
return False
-
+
def set_active_config(self, config_type: ConfigType, config_id: str) -> bool:
"""Set a configuration as active."""
data = self._load_configs(config_type)
-
+
# Verify config exists
if config_id != "default":
found = any(c.get("id") == config_id for c in data.get("configs", []))
if not found:
return False
-
+
data["active_id"] = config_id
return self._save_configs(config_type, data)
-
+
def get_env_status(self, config_type: ConfigType) -> Dict[str, bool]:
"""Check which environment variables are configured for a service type."""
env_mapping = ENV_VAR_MAPPINGS.get(config_type, {})
status = {}
-
+
for field, env_var in env_mapping.items():
if not env_var.endswith("_key"): # Skip individual search provider keys
status[field] = bool(_get_env_value(env_var))
-
+
return status
-
+
def get_default_config(self, config_type: ConfigType) -> Dict[str, Any]:
"""
Get the default configuration with actual values resolved.
Used for testing the default configuration.
"""
return self._get_default_config_resolved(config_type)
-
+
def resolve_config_env_values(self, config: Dict[str, Any]) -> Dict[str, Any]:
"""
Resolve all {"use_env": "VAR_NAME"} references in a user configuration.
@@ -447,4 +458,3 @@ def get_active_tts_config() -> Optional[Dict[str, Any]]:
def get_active_search_config() -> Optional[Dict[str, Any]]:
"""Get the active search configuration."""
return get_config_manager().get_active_config(ConfigType.SEARCH)
-
diff --git a/src/services/search/__init__.py b/src/services/search/__init__.py
index c77bac0d2..a21a73293 100644
--- a/src/services/search/__init__.py
+++ b/src/services/search/__init__.py
@@ -34,9 +34,9 @@ Environment Variables:
- SEARCH_API_KEY: Unified API key for all providers
"""
+from datetime import datetime
import json
import os
-from datetime import datetime
from pathlib import Path
from typing import Any
@@ -282,4 +282,3 @@ __all__ = [
"SearchProvider",
"SEARCH_API_KEY_ENV",
]
-
diff --git a/src/services/search/base.py b/src/services/search/base.py
index f2ce40596..c9e95e615 100644
--- a/src/services/search/base.py
+++ b/src/services/search/base.py
@@ -5,15 +5,14 @@ This module defines the BaseSearchProvider class that all search providers must
All providers use a unified SEARCH_API_KEY environment variable.
"""
-import os
from abc import ABC, abstractmethod
+import os
from typing import Any
from src.logging import get_logger
from .types import WebSearchResponse
-
# Unified API key environment variable
SEARCH_API_KEY_ENV = "SEARCH_API_KEY"
@@ -86,4 +85,3 @@ class BaseSearchProvider(ABC):
__all__ = ["BaseSearchProvider", "SEARCH_API_KEY_ENV"]
-
diff --git a/src/services/search/consolidation.py b/src/services/search/consolidation.py
index 0df2b7d63..13899ad93 100644
--- a/src/services/search/consolidation.py
+++ b/src/services/search/consolidation.py
@@ -181,7 +181,9 @@ class AnswerConsolidator:
self.custom_template = custom_template
self.llm_config = llm_config or {}
self.max_results = max_results
- self.jinja_env = Environment(loader=BaseLoader(), autoescape=autoescape)
+ # Security: autoescape defaults to True (set in function signature above).
+ # When True, Jinja2 auto-escapes HTML to prevent XSS.
+ self.jinja_env = Environment(loader=BaseLoader(), autoescape=autoescape) # nosec B701
if self.custom_template is not None and autoescape:
_logger.warning(
@@ -394,4 +396,3 @@ Consolidate these results into structured grounding context."""
__all__ = ["AnswerConsolidator", "CONSOLIDATION_TYPES", "PROVIDER_TEMPLATES"]
-
diff --git a/src/services/search/providers/__init__.py b/src/services/search/providers/__init__.py
index 9aa72c4a7..bd3a0ab16 100644
--- a/src/services/search/providers/__init__.py
+++ b/src/services/search/providers/__init__.py
@@ -126,4 +126,3 @@ __all__ = [
"get_providers_info",
"get_default_provider",
]
-
diff --git a/src/services/search/providers/baidu.py b/src/services/search/providers/baidu.py
index c4fdf2a8a..88b2493fa 100644
--- a/src/services/search/providers/baidu.py
+++ b/src/services/search/providers/baidu.py
@@ -186,4 +186,3 @@ class BaiduProvider(BaseSearchProvider):
)
return response_obj
-
diff --git a/src/services/search/providers/exa.py b/src/services/search/providers/exa.py
index fb964a072..bc62f7ba8 100644
--- a/src/services/search/providers/exa.py
+++ b/src/services/search/providers/exa.py
@@ -192,4 +192,3 @@ class ExaProvider(BaseSearchProvider):
)
return response_obj
-
diff --git a/src/services/search/providers/jina.py b/src/services/search/providers/jina.py
index 486b9ca64..b877fdceb 100644
--- a/src/services/search/providers/jina.py
+++ b/src/services/search/providers/jina.py
@@ -15,9 +15,9 @@ Features:
- Free tier: 10M tokens
"""
-import urllib.parse
from datetime import datetime
from typing import Any
+import urllib.parse
import requests
@@ -159,4 +159,3 @@ class JinaProvider(BaseSearchProvider):
)
return response_obj
-
diff --git a/src/services/search/providers/perplexity.py b/src/services/search/providers/perplexity.py
index 80997ea0b..54e989333 100644
--- a/src/services/search/providers/perplexity.py
+++ b/src/services/search/providers/perplexity.py
@@ -151,4 +151,3 @@ class PerplexityProvider(BaseSearchProvider):
)
return response
-
diff --git a/src/services/search/providers/serper.py b/src/services/search/providers/serper.py
index aa5b308b8..9b698269b 100644
--- a/src/services/search/providers/serper.py
+++ b/src/services/search/providers/serper.py
@@ -13,8 +13,8 @@ Features:
- Very cheap: $1/1000 queries at scale
"""
-import json
from datetime import datetime
+import json
from typing import Any
import requests
@@ -207,4 +207,3 @@ class SerperProvider(BaseSearchProvider):
usage={},
metadata=metadata,
)
-
diff --git a/src/services/search/providers/tavily.py b/src/services/search/providers/tavily.py
index 9cd3d7fd1..4668d7d87 100644
--- a/src/services/search/providers/tavily.py
+++ b/src/services/search/providers/tavily.py
@@ -12,8 +12,8 @@ Features:
- Domain include/exclude lists
"""
-import json
from datetime import datetime
+import json
from typing import Any
import requests
@@ -159,4 +159,3 @@ class TavilyProvider(BaseSearchProvider):
)
return response_obj
-
diff --git a/src/services/search/types.py b/src/services/search/types.py
index cea3963ad..8efa75db5 100644
--- a/src/services/search/types.py
+++ b/src/services/search/types.py
@@ -112,4 +112,3 @@ class WebSearchResponse:
__all__ = ["Citation", "SearchResult", "WebSearchResponse"]
-
diff --git a/src/tools/question/__init__.py b/src/tools/question/__init__.py
index 57c9ebcd7..bff4d8558 100644
--- a/src/tools/question/__init__.py
+++ b/src/tools/question/__init__.py
@@ -13,4 +13,3 @@ __all__ = [
"extract_questions_from_paper",
"mimic_exam_questions",
]
-
diff --git a/src/tools/question/exam_mimic.py b/src/tools/question/exam_mimic.py
index 8fea6530d..8cdc7775b 100644
--- a/src/tools/question/exam_mimic.py
+++ b/src/tools/question/exam_mimic.py
@@ -27,9 +27,9 @@ project_root = Path(__file__).parent.parent.parent.parent
sys.path.insert(0, str(project_root))
# Note: AgentCoordinator is imported inside functions to avoid circular import
+from src.services.llm.config import get_llm_config
from src.tools.question.pdf_parser import parse_pdf_with_mineru
from src.tools.question.question_extractor import extract_questions_from_paper
-from src.services.llm.config import get_llm_config
# Type alias for WebSocket callback
WsCallback = Callable[[str, dict[str, Any]], Any]
@@ -614,4 +614,3 @@ Examples:
if __name__ == "__main__":
asyncio.run(main())
-
diff --git a/src/tools/question/pdf_parser.py b/src/tools/question/pdf_parser.py
index 4f5596a4b..f3b25c016 100644
--- a/src/tools/question/pdf_parser.py
+++ b/src/tools/question/pdf_parser.py
@@ -15,8 +15,14 @@ import sys
def check_mineru_installed():
"""Check if MinerU is installed"""
try:
+ # Security: Using partial path is intentional here - we need to find
+ # the command in user's PATH. These are trusted CLI tools, not user input.
result = subprocess.run(
- ["magic-pdf", "--version"], check=False, capture_output=True, text=True, shell=False
+ ["magic-pdf", "--version"], # nosec B607
+ check=False,
+ capture_output=True,
+ text=True,
+ shell=False,
)
if result.returncode == 0:
return "magic-pdf"
@@ -24,8 +30,13 @@ def check_mineru_installed():
pass
try:
+ # Security: Same as above - intentionally using PATH lookup for CLI tool.
result = subprocess.run(
- ["mineru", "--version"], check=False, capture_output=True, text=True, shell=False
+ ["mineru", "--version"], # nosec B607
+ check=False,
+ capture_output=True,
+ text=True,
+ shell=False,
)
if result.returncode == 0:
return "mineru"
@@ -198,4 +209,3 @@ Examples:
if __name__ == "__main__":
main()
-
diff --git a/src/tools/question/question_extractor.py b/src/tools/question/question_extractor.py
index d9b01eff2..ff523a796 100644
--- a/src/tools/question/question_extractor.py
+++ b/src/tools/question/question_extractor.py
@@ -392,4 +392,3 @@ Examples:
if __name__ == "__main__":
main()
-
diff --git a/src/tools/web_search.py b/src/tools/web_search.py
index 822dec9e3..492a258ed 100644
--- a/src/tools/web_search.py
+++ b/src/tools/web_search.py
@@ -69,4 +69,3 @@ __all__ = [
"SearchProvider",
"SEARCH_API_KEY_ENV",
]
-
diff --git a/web/.env.local b/web/.env.local
index 0b6543af3..8840a64d6 100644
--- a/web/.env.local
+++ b/web/.env.local
@@ -3,7 +3,7 @@
# ============================================
# This file is automatically updated based on config/main.yaml
# and environment variables (NEXT_PUBLIC_API_BASE, NEXT_PUBLIC_API_BASE_EXTERNAL)
-#
+#
# To configure for remote access, set in your .env file:
# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
# ============================================
diff --git a/web/app/knowledge/page.tsx b/web/app/knowledge/page.tsx
index 543848e8f..37f415fcf 100644
--- a/web/app/knowledge/page.tsx
+++ b/web/app/knowledge/page.tsx
@@ -984,10 +984,11 @@ export default function KnowledgePage() {
Upload Documents
</label>
<div
- className={`border-2 border-dashed rounded-xl p-8 text-center transition-colors ${dragActive
+ className={`border-2 border-dashed rounded-xl p-8 text-center transition-colors ${
+ dragActive
? "border-blue-500 bg-blue-50 dark:bg-blue-900/30"
: "border-slate-200 dark:border-slate-600 hover:border-blue-400 dark:hover:border-blue-500 bg-slate-50 dark:bg-slate-700/50"
- }`}
+ }`}
onDragEnter={handleDrag}
onDragLeave={handleDrag}
onDragOver={handleDrag}
diff --git a/web/components/LayoutWrapper.tsx b/web/components/LayoutWrapper.tsx
index 5ad65649c..802ca0eab 100644
--- a/web/components/LayoutWrapper.tsx
+++ b/web/components/LayoutWrapper.tsx
@@ -6,7 +6,7 @@ interface LayoutWrapperProps {
/**
* LayoutWrapper - Simplified
- *
+ *
* Previously handled setup wizard display logic.
* Now just a simple wrapper for children.
*/
diff --git a/web/components/index.ts b/web/components/index.ts
index 7fc66b10c..36f2a963d 100644
--- a/web/components/index.ts
+++ b/web/components/index.ts
@@ -10,7 +10,6 @@ export { default as Sidebar } from "./Sidebar";
export { default as ActivityDetail } from "./ActivityDetail";
export { default as CoWriterEditor } from "./CoWriterEditor";
export { default as AddToNotebookModal } from "./AddToNotebookModal";
-export { default as SetupWizard } from "./SetupWizard";
export { default as LayoutWrapper } from "./LayoutWrapper";
// Re-export types if needed
diff --git a/web/components/question/LogDrawer.tsx b/web/components/question/LogDrawer.tsx
index f72d40dc5..ad9ec7c97 100644
--- a/web/components/question/LogDrawer.tsx
+++ b/web/components/question/LogDrawer.tsx
@@ -169,7 +169,7 @@ export const LogDrawer: React.FC<LogDrawerProps> = ({
{/* Drawer - matches the app styling */}
<div
className={`
- fixed top-0 right-0 h-full w-full sm:w-[400px] bg-white dark:bg-slate-800
+ fixed top-0 right-0 h-full w-full sm:w-[400px] bg-white dark:bg-slate-800
border-l border-slate-200 dark:border-slate-700 z-50
transform transition-transform duration-300 ease-out
shadow-2xl
@@ -206,7 +206,10 @@ export const LogDrawer: React.FC<LogDrawerProps> = ({
: "Generating"}
</h2>
<p className="text-xs text-slate-500 dark:text-slate-400">
- {stage || "idle"}{progress?.current && progress?.total ? ` · ${progress.current}/${progress.total}` : ""}
+ {stage || "idle"}
+ {progress?.current && progress?.total
+ ? ` · ${progress.current}/${progress.total}`
+ : ""}
</p>
</div>
</div>
@@ -231,13 +234,22 @@ export const LogDrawer: React.FC<LogDrawerProps> = ({
</p>
<div className="flex flex-wrap gap-3 text-xs text-slate-500 dark:text-slate-400">
<span>
- Difficulty: <strong className="capitalize text-slate-700 dark:text-slate-200">{difficulty}</strong>
+ Difficulty:{" "}
+ <strong className="capitalize text-slate-700 dark:text-slate-200">
+ {difficulty}
+ </strong>
</span>
<span>
- Type: <strong className="capitalize text-slate-700 dark:text-slate-200">{questionType}</strong>
+ Type:{" "}
+ <strong className="capitalize text-slate-700 dark:text-slate-200">
+ {questionType}
+ </strong>
</span>
<span>
- Count: <strong className="text-slate-700 dark:text-slate-200">{count}</strong>
+ Count:{" "}
+ <strong className="text-slate-700 dark:text-slate-200">
+ {count}
+ </strong>
</span>
</div>
</div>