feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持
This commit is contained in:
1 parent
ac4262cd75
commit
c8ce77199e
183 files changed
+11690
-2300
No files matched your search
@@ -70,23 +70,26 @@ def test_department_crud(client):
|
||||
assert len(res.get_json()) == 0
|
||||
|
||||
def test_agent_crud(client):
|
||||
from tests.conftest import parse_api_data
|
||||
headers = get_headers(client)
|
||||
|
||||
# Create
|
||||
res = client.post('/api/admin/agents', json={
|
||||
'name': 'Test Agent',
|
||||
'dify_app_id': 'app-123',
|
||||
'dify_api_key': 'sk-test-key',
|
||||
'description': 'Test Description'
|
||||
}, headers=headers)
|
||||
assert res.status_code == 201
|
||||
agent_id = res.get_json()['id']
|
||||
agent_id = parse_api_data(res.get_json())['id']
|
||||
|
||||
# List
|
||||
res = client.get('/api/admin/agents', headers=headers)
|
||||
assert res.status_code == 200
|
||||
agents = res.get_json()
|
||||
agents = parse_api_data(res.get_json())
|
||||
assert len(agents) == 1
|
||||
assert agents[0]['name'] == 'Test Agent'
|
||||
assert 'dify_api_key' not in agents[0]
|
||||
|
||||
# Update
|
||||
res = client.put(f'/api/admin/agents/{agent_id}', json={
|
||||
@@ -96,13 +99,13 @@ def test_agent_crud(client):
|
||||
|
||||
# Verify Update
|
||||
res = client.get('/api/admin/agents', headers=headers)
|
||||
assert res.get_json()[0]['name'] == 'Updated Agent'
|
||||
assert parse_api_data(res.get_json())[0]['name'] == 'Updated Agent'
|
||||
|
||||
# Delete
|
||||
res = client.delete(f'/api/admin/agents/{agent_id}', headers=headers)
|
||||
assert res.status_code == 200
|
||||
res = client.get('/api/admin/agents', headers=headers)
|
||||
assert len(res.get_json()) == 0
|
||||
assert len(parse_api_data(res.get_json())) == 0
|
||||
|
||||
def test_permission_flow(client):
|
||||
admin_headers = get_headers(client)
|
||||
|
||||
Reference in new issue
Block a user