add choose skills function
This commit is contained in:
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from docx import Document
|
||||
|
||||
from app.main import OUTPUT_DIR, ROOT_DIR, analyze_saved_docx
|
||||
from app.main import OUTPUT_DIR, ROOT_DIR, analyze_saved_docx, app
|
||||
|
||||
|
||||
def test_index_template_contains_upload_ui() -> None:
|
||||
@@ -14,9 +14,11 @@ def test_index_template_contains_upload_ui() -> None:
|
||||
assert "analysis-progress" in html
|
||||
assert "analysis-status" in html
|
||||
assert "下载 Markdown 报告" in html
|
||||
assert "<!-- <a id=\"download-docx\"" in html
|
||||
assert "download-md" in js
|
||||
assert "pollTask" in js
|
||||
assert "skill_collection" in html
|
||||
assert "预留后续版本:单个技能集合内的 skill 筛选功能" in html
|
||||
assert not any(route.path == "/skills" for route in app.routes)
|
||||
|
||||
|
||||
def test_analyze_saved_docx_reports_progress(tmp_path: Path) -> None:
|
||||
@@ -53,3 +55,20 @@ def test_analyze_saved_docx_creates_downloadable_report(tmp_path: Path) -> None:
|
||||
assert "docx" not in payload["downloads"]
|
||||
assert payload["downloads"]["markdown"].endswith(".md")
|
||||
assert (OUTPUT_DIR / Path(payload["downloads"]["markdown"]).name).exists()
|
||||
|
||||
|
||||
def test_analyze_saved_docx_uses_selected_collection(tmp_path: Path) -> None:
|
||||
docx_path = tmp_path / "upload.docx"
|
||||
document = Document()
|
||||
document.add_heading("软件需求规格说明", level=1)
|
||||
document.add_paragraph("能力需求、接口需求、合格性规定。")
|
||||
document.save(docx_path)
|
||||
|
||||
payload = analyze_saved_docx(
|
||||
docx_path,
|
||||
provider="deepseek",
|
||||
use_model=False,
|
||||
skill_collection="GJB438B-2009_prd_skills",
|
||||
)
|
||||
|
||||
assert payload["matched_skills"]
|
||||
|
||||
Reference in New Issue
Block a user