mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 04:49:39 +08:00
feat: release ver0.3.0
This commit is contained in:
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@@ -84,4 +84,3 @@ updates:
|
||||
- "docker"
|
||||
commit-message:
|
||||
prefix: "chore(deps)"
|
||||
|
||||
|
||||
1
.github/workflows/docker-publish.yml
vendored
1
.github/workflows/docker-publish.yml
vendored
@@ -105,4 +105,3 @@ jobs:
|
||||
echo " -e EMBEDDING_BINDING_API_KEY=your-api-key \\\\" >> $GITHUB_STEP_SUMMARY
|
||||
echo " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
|
||||
1
.github/workflows/tests.yml
vendored
1
.github/workflows/tests.yml
vendored
@@ -89,4 +89,3 @@ jobs:
|
||||
python -c "from src.tools.rag_tool import RAGTool; print('✅ Tools imports OK')"
|
||||
env:
|
||||
PYTHONPATH: ${{ github.workspace }}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
|
||||
---
|
||||
> **[2026.1.3]** Released DeepTutor [v0.2.1](https://github.com/HKUDS/DeepTutor/releases/tag/v0.2.1) - Any feedbacks are welcomed! ❤️
|
||||
> **[2026.1.3]** Released DeepTutor [v0.3.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.3.0) - Any feedbacks are welcomed! ❤️
|
||||
|
||||
> **[2026.1.1]** Join our [Discord Community](https://discord.gg/zpP9cssj) and [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) - shape the future of DeepTutor! 💬
|
||||
|
||||
|
||||
@@ -67,4 +67,3 @@ async def get_single_agent_config(agent_type: str):
|
||||
if agent_type in AGENT_REGISTRY:
|
||||
return AGENT_REGISTRY[agent_type]
|
||||
return {"error": f"Agent type '{agent_type}' not found"}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from .core import parse_language, PROJECT_ROOT
|
||||
from .core import PROJECT_ROOT, parse_language
|
||||
|
||||
|
||||
class PromptManager:
|
||||
@@ -84,9 +84,7 @@ class PromptManager:
|
||||
fallback_chain = self.LANGUAGE_FALLBACKS.get(lang_code, ["en"])
|
||||
|
||||
for lang in fallback_chain:
|
||||
prompt_file = self._resolve_prompt_path(
|
||||
prompts_dir, lang, agent_name, subdirectory
|
||||
)
|
||||
prompt_file = self._resolve_prompt_path(prompts_dir, lang, agent_name, subdirectory)
|
||||
if prompt_file and prompt_file.exists():
|
||||
try:
|
||||
with open(prompt_file, encoding="utf-8") as f:
|
||||
@@ -206,4 +204,3 @@ def get_prompt_manager() -> PromptManager:
|
||||
|
||||
|
||||
__all__ = ["PromptManager", "get_prompt_manager"]
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
# Core module tests
|
||||
|
||||
|
||||
@@ -80,41 +80,41 @@ class TestPromptManager:
|
||||
def test_caching(self):
|
||||
"""Test that prompts are cached after first load."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
# First load
|
||||
prompts1 = pm.load_prompts("research", "research_agent", "en")
|
||||
|
||||
|
||||
# Second load should return cached version
|
||||
prompts2 = pm.load_prompts("research", "research_agent", "en")
|
||||
|
||||
|
||||
assert prompts1 is prompts2
|
||||
|
||||
def test_clear_cache_all(self):
|
||||
"""Test clearing all cache."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
# Load some prompts
|
||||
pm.load_prompts("research", "research_agent", "en")
|
||||
pm.load_prompts("guide", "chat_agent", "en")
|
||||
|
||||
|
||||
assert len(pm._cache) >= 2
|
||||
|
||||
|
||||
pm.clear_cache()
|
||||
assert len(pm._cache) == 0
|
||||
|
||||
def test_clear_cache_module_specific(self):
|
||||
"""Test clearing cache for specific module."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
# Load prompts for multiple modules
|
||||
pm.load_prompts("research", "research_agent", "en")
|
||||
pm.load_prompts("guide", "chat_agent", "en")
|
||||
|
||||
|
||||
initial_count = len(pm._cache)
|
||||
|
||||
|
||||
# Clear only research cache
|
||||
pm.clear_cache("research")
|
||||
|
||||
|
||||
# Guide prompts should still be cached
|
||||
assert any("guide" in k for k in pm._cache)
|
||||
assert not any("research" in k for k in pm._cache)
|
||||
@@ -122,7 +122,7 @@ class TestPromptManager:
|
||||
def test_get_prompt_helper(self):
|
||||
"""Test the get_prompt helper method."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
test_prompts = {
|
||||
"system": {
|
||||
"role": "You are a helpful assistant",
|
||||
@@ -130,15 +130,15 @@ class TestPromptManager:
|
||||
},
|
||||
"simple_key": "Simple value",
|
||||
}
|
||||
|
||||
|
||||
# Test nested access
|
||||
role = pm.get_prompt(test_prompts, "system", "role")
|
||||
assert role == "You are a helpful assistant"
|
||||
|
||||
|
||||
# Test simple access (no field)
|
||||
simple = pm.get_prompt(test_prompts, "simple_key")
|
||||
assert simple == "Simple value"
|
||||
|
||||
|
||||
# Test fallback
|
||||
missing = pm.get_prompt(test_prompts, "nonexistent", "field", "fallback_value")
|
||||
assert missing == "fallback_value"
|
||||
@@ -146,7 +146,7 @@ class TestPromptManager:
|
||||
def test_language_fallback(self):
|
||||
"""Test language fallback chain."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
# Even with a potentially missing language, should fallback
|
||||
prompts = pm.load_prompts("research", "research_agent", "zh")
|
||||
assert isinstance(prompts, dict)
|
||||
@@ -154,13 +154,13 @@ class TestPromptManager:
|
||||
def test_reload_prompts(self):
|
||||
"""Test force reload bypasses cache."""
|
||||
pm = get_prompt_manager()
|
||||
|
||||
|
||||
# Load and cache
|
||||
prompts1 = pm.load_prompts("research", "research_agent", "en")
|
||||
|
||||
|
||||
# Force reload
|
||||
prompts2 = pm.reload_prompts("research", "research_agent", "en")
|
||||
|
||||
|
||||
# They should be equal but not the same object
|
||||
assert prompts1 == prompts2
|
||||
# After reload, cache should have fresh entry
|
||||
@@ -197,4 +197,3 @@ class TestPromptManagerLanguages:
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user