Reflect new commands in the history

This commit is contained in:
Jorge Manrubia
2025-05-15 15:49:32 +02:00
parent 88fd3a7aaa
commit 09f5efc100
5 changed files with 9 additions and 6 deletions
+5 -1
View File
@@ -56,7 +56,11 @@ class CommandsController < ApplicationController
def respond_with_composite_response(results)
json = results.map(&:as_json).grep(Hash).reduce({}, :merge)
render json: json, status: :accepted
if json.empty?
redirect_back_or_to root_path
else
render json: json, status: :accepted
end
end
def respond_with_insight_response(chat_response)
@@ -3,7 +3,7 @@ import { HttpStatus } from "helpers/http_helpers"
import { marked } from "marked"
export default class extends Controller {
static targets = [ "input", "form", "output", "confirmation" ]
static targets = [ "input", "form", "output", "confirmation", "recentCommands" ]
static classes = [ "error", "confirmation", "help", "output", "busy" ]
static values = { originalInput: String, waitingForConfirmation: Boolean }
@@ -89,6 +89,7 @@ export default class extends Controller {
this.#handleJsonResponse(responseJson)
})
}
this.recentCommandsTarget.reload()
this.#reset()
}
-2
View File
@@ -9,14 +9,12 @@
<label class="terminal__label txt-nowrap" for="fizzy_do">Fizzy do &gt;</label>
<%= text_field_tag "command", nil,
id: "terminal_input",
autocomplete: "off",
autocorrect: "off",
autocapitalize: "off",
class: "terminal__input input fill-transparent unpad",
data: {
terminal_target: "input",
turbo_permanent: true,
action: "keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrLast terminal#hideError"
},
placeholder: "Press ⌘+K to search or type /commands…",
+1 -1
View File
@@ -10,7 +10,7 @@
terminal_busy_class: "terminal--busy",
toggle_class_toggle_class: "terminal--open",
action: "keydown->terminal#handleKeyPress keydown->navigable-list#navigate focusin->navigable-list#select keydown.esc->toggle-class#remove:stop keydown.esc->terminal#focus keydown.esc->navigable-list#selectLast keydown.esc@document->terminal#hideMenus" } do %>
<%= turbo_frame_tag :recent_commands, src: commands_path, refresh: "morph" %>
<%= turbo_frame_tag :recent_commands, src: commands_path, data: { terminal_target: "recentCommands" } %>
<%= render "commands/form" %>
<% end %>
+1 -1
View File
@@ -47,7 +47,7 @@
<%= yield :footer %>
<% if Current.user && !@hide_footer_frames %>
<div id="footer_frames">
<div id="footer_frames" data-turbo-permanent="true" >
<%= render "notifications/tray" %>
<%= render "my/pins/tray" %>
<%= render "commands/terminal" %>