Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Commit 5baf258

Browse files
committed
Fix transactions tool call for chat
1 parent bacab94 commit 5baf258

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/models/assistant/function/get_transactions.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def params_schema
134134
def call(params = {})
135135
search_params = params.except("order", "page")
136136

137-
transactions_query = family.transactions.visible.search(search_params)
137+
search = Transaction::Search.new(family, filters: search_params)
138+
transactions_query = search.transactions_scope
138139
pagy_query = params["order"] == "asc" ? transactions_query.chronological : transactions_query.reverse_chronological
139140

140141
# By default, we give a small page size to force the AI to use filters effectively and save on tokens
@@ -149,7 +150,7 @@ def call(params = {})
149150
limit: default_page_size
150151
)
151152

152-
totals = family.income_statement.totals(transactions_scope: transactions_query)
153+
totals = search.totals
153154

154155
normalized_transactions = paginated_transactions.map do |txn|
155156
entry = txn.entry

0 commit comments

Comments
 (0)