feat(app): add native chat sessions browser
This commit is contained in:
@@ -222,6 +222,7 @@ void main() {
|
||||
'session_id': 's',
|
||||
'text': 'hi',
|
||||
'operation_id': 'same',
|
||||
'native_message_id': 'msg_same',
|
||||
},
|
||||
});
|
||||
await repo.answerForm('s', 'f', {'choice': 'yes'}, action: 'submit');
|
||||
@@ -239,7 +240,7 @@ void main() {
|
||||
'session_id': 's',
|
||||
'request_id': 'r',
|
||||
'decision': 'once',
|
||||
'client': 'web',
|
||||
'client': 'Web',
|
||||
'message': 'approved',
|
||||
},
|
||||
});
|
||||
@@ -255,5 +256,41 @@ void main() {
|
||||
expect(gateway.calls.last.type, 'chat_model');
|
||||
},
|
||||
);
|
||||
test('rejects invalid permissions and prompts before sending', () async {
|
||||
expect(
|
||||
() => repo.prompt(' ', 'hello', operationId: 'x'),
|
||||
throwsArgumentError,
|
||||
);
|
||||
expect(
|
||||
() => repo.prompt('s', ' ', operationId: 'x'),
|
||||
throwsArgumentError,
|
||||
);
|
||||
expect(
|
||||
() => repo.replyPermission('s', 'r', 'approve'),
|
||||
throwsArgumentError,
|
||||
);
|
||||
expect(gateway.calls, isEmpty);
|
||||
});
|
||||
test(
|
||||
'uses the server model catalog object and default history limit',
|
||||
() async {
|
||||
gateway.reply = {
|
||||
'chat_models': {
|
||||
'providers': {
|
||||
'p': ['m'],
|
||||
},
|
||||
},
|
||||
};
|
||||
expect((await repo.models('s'))['providers'], {
|
||||
'p': ['m'],
|
||||
});
|
||||
expect(gateway.calls.single.fields, {
|
||||
'chat_query': {'session_id': 's'},
|
||||
});
|
||||
gateway.calls.clear();
|
||||
await repo.history('s');
|
||||
expect(gateway.calls.single.fields['chat_query']['limit'], 200);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user