Use composite commands even for single commands since they can carry custom titles, which is what we want with AI

This commit is contained in:
Jorge Manrubia
2025-07-03 16:26:52 +02:00
parent 7e2f3894f6
commit 702169384c
4 changed files with 7 additions and 14 deletions
+1 -12
View File
@@ -30,11 +30,7 @@ class Command::Ai::Parser
commands.unshift Command::VisitUrl.new(user: user, url: query_context.url, context: resolved_context)
end
if commands.many?
Command::Composite.new(title: query, commands: commands, user: user, line: query, context: resolved_context)
else
build_standalone_command(commands, query)
end
Command::Composite.new(title: query, commands: commands, user: user, line: query, context: resolved_context)
end
def commands_from_query(normalized_query, context)
@@ -44,13 +40,6 @@ class Command::Ai::Parser
end
end
# This saves unnecessary interchanges with browser for redirect responses
def build_standalone_command(commands, query)
commands.first.tap do |command|
command.line = query
end
end
def resolve_named_params_to_ids(normalized_query)
normalized_query.tap do |query_json|
if query_context = query_json[:context].presence