agent请假推申请单到OA
This commit is contained in:
1 parent
aeb6b66513
commit
367c20eb09
15 files changed
+1833
-143
No files matched your search
@@ -84,3 +84,28 @@ def test_chat_messages_history(client):
|
||||
assert len(msgs) == 2 # User + Assistant
|
||||
assert msgs[0]['content'] == 'Hi'
|
||||
assert msgs[1]['content'] == 'Hello'
|
||||
|
||||
|
||||
def test_chat_sessions_keep_latest_non_empty_query_as_title(client):
|
||||
headers = get_headers(client)
|
||||
|
||||
with client.application.app_context():
|
||||
user = User.query.filter_by(username='testuser').first()
|
||||
agent = Agent.query.filter_by(name='Test Agent').first()
|
||||
db.session.add(ChatLog(
|
||||
user_id=user.id,
|
||||
agent_id=agent.id,
|
||||
conversation_id='conv1',
|
||||
query='',
|
||||
answer='请填写请假表单',
|
||||
message_type='leave-form',
|
||||
created_at=datetime(2026, 1, 2),
|
||||
))
|
||||
db.session.commit()
|
||||
|
||||
res = client.get('/api/chat/sessions?agent_id=1', headers=headers)
|
||||
assert res.status_code == 200
|
||||
data = res.get_json()
|
||||
assert len(data) == 1
|
||||
assert data[0]['conversation_id'] == 'conv1'
|
||||
assert data[0]['title'] == 'Hi'
|
||||
Reference in new issue
Block a user