fix to allow /api/messages/<graph_id>/<node_id> to get none node_id
This commit is contained in:
parent
bb4ba2644c
commit
0fe58687f8
|
|
@ -68,6 +68,13 @@ def get_messages_from_root_to_node(graph_id, node_id):
|
|||
if not graph_data:
|
||||
return jsonify({"error": "Граф не найден."}, 404)
|
||||
|
||||
target_node_id = node_id
|
||||
if node_id == 'last':
|
||||
target_node_id = graph_data.get('current_node_id')
|
||||
if not target_node_id:
|
||||
return jsonify({"error": "В графе нет активного узла, до которого можно было бы получить сообщения."}, 404)
|
||||
|
||||
messages = graph_history_manager.get_messages_from_root_to_node(
|
||||
graph_data, node_id)
|
||||
graph_data, target_node_id)
|
||||
return jsonify(messages)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user