Fix transactions tool call for chat
This commit is contained in:
@@ -134,7 +134,8 @@ class Assistant::Function::GetTransactions < Assistant::Function
|
||||
def call(params = {})
|
||||
search_params = params.except("order", "page")
|
||||
|
||||
transactions_query = family.transactions.visible.search(search_params)
|
||||
search = Transaction::Search.new(family, filters: search_params)
|
||||
transactions_query = search.transactions_scope
|
||||
pagy_query = params["order"] == "asc" ? transactions_query.chronological : transactions_query.reverse_chronological
|
||||
|
||||
# By default, we give a small page size to force the AI to use filters effectively and save on tokens
|
||||
@@ -149,7 +150,7 @@ class Assistant::Function::GetTransactions < Assistant::Function
|
||||
limit: default_page_size
|
||||
)
|
||||
|
||||
totals = family.income_statement.totals(transactions_scope: transactions_query)
|
||||
totals = search.totals
|
||||
|
||||
normalized_transactions = paginated_transactions.map do |txn|
|
||||
entry = txn.entry
|
||||
|
||||
Reference in New Issue
Block a user