feat: 完成三角色工作台及金租对公Skills全流程演示
This commit is contained in:
@@ -8,7 +8,7 @@ from langchain_core.outputs import ChatResult, ChatGeneration
|
||||
from graph.agent import AgentManager
|
||||
from graph.risk_task import invoke_risk_task
|
||||
from tools.risk_task_tools import create_risk_tools
|
||||
from tools.skills_scanner import discover_skills, scan_skills
|
||||
from tools.skills_scanner import discover_skills, install_skill, scan_skills
|
||||
|
||||
|
||||
class ToolModel(BaseChatModel):
|
||||
@@ -49,6 +49,16 @@ class CoreTests(unittest.TestCase):
|
||||
output=invoke_risk_task({"native_skills":["risk/SKILL.md"]},self.context(),{},"http://127.0.0.1:11434/v1",base)
|
||||
self.assertIn("Only suggest",output["native_skills"][0]["content"])
|
||||
self.assertTrue(output["messages"])
|
||||
def test_archived_native_skills_are_hidden_and_folder_import_is_managed(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
base=Path(root)
|
||||
archived=base/"skills"/"old"/"SKILL.md";archived.parent.mkdir(parents=True)
|
||||
archived.write_text("---\nname: old-skill\ndescription: Old unrelated method\nstatus: archived\n---\nOld",encoding="utf-8")
|
||||
content="---\nname: leasing-check\ndisplay_name: 金租核查\ndescription: Review leasing evidence\ninputs: [lease.total_value]\n---\nRead evidence first."
|
||||
installed=install_skill(base,content)
|
||||
self.assertEqual(installed["id"],"imported/leasing-check/SKILL.md")
|
||||
self.assertEqual([s["name"] for s in discover_skills(base)],["leasing-check"])
|
||||
with self.assertRaises(FileExistsError):install_skill(base,content)
|
||||
def test_tools_cannot_read_unselected_resources(self):
|
||||
tools={t.name:t for t in create_risk_tools(self.context(),{}, {})}
|
||||
self.assertIn("授权",tools["read_data_card"].invoke({"index":99}))
|
||||
|
||||
Reference in New Issue
Block a user