Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ require('goose').setup({
window = {
submit = '<cr>', -- Submit prompt
close = '<esc>', -- Close UI windows
stop = '<C-c>', -- Stop a running job
stop = '<C-c>', -- Stop goose while it is running
next_message = ']]', -- Navigate to next message in the conversation
prev_message = '[[', -- Navigate to previous message in the conversation
mention_file = '@', -- Pick a file and add to context. See File Mentions section
Expand Down
3 changes: 2 additions & 1 deletion lua/goose/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ function M.get_all_sessions()
return {
workspace = session.metadata.working_dir,
description = session.metadata.description,
message_count = session.metadata.message_count,
tokens = session.metadata.total_tokens,
modified = session.modified,
name = session.id,
path = session.path
}
end, sessions)
end

-- Helper function to get all sessions as JSON
function M.get_all_workspace_sessions()
local sessions = M.get_all_sessions()
if not sessions then return nil end
Expand Down
8 changes: 7 additions & 1 deletion lua/goose/ui/output_renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@ end

function M.render_session_bar()
local function update_winbar(desc)
-- content
--[[ ** TODO: use this right side win bar text with something useful
local winwidth = vim.api.nvim_win_get_width(state.windows.output_win)
local txt = "txt content here"
local padding = string.rep(" ", winwidth - #desc - #txt - 1)
local right_side_txt = padding .. txt
]]

vim.wo[state.windows.output_win].winbar = " " .. desc

-- Add our winbar highlights while preserving existing highlights
Expand Down
5 changes: 3 additions & 2 deletions lua/goose/ui/session_formatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ function M._format_message(message)

for _, part in ipairs(message.content) do
if part.type == 'text' and part.text and part.text ~= "" then
local text = vim.trim(part.text)
has_content = true

if message.role == 'user' then
M._format_user_message(lines, part.text)
M._format_user_message(lines, text)
elseif message.role == 'assistant' then
for _, line in ipairs(vim.split(part.text, "\n")) do
for _, line in ipairs(vim.split(text, "\n")) do
table.insert(lines, line)
end
end
Expand Down
16 changes: 13 additions & 3 deletions lua/goose/ui/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,22 @@ function M.select_session(sessions, cb)
vim.ui.select(sessions, {
prompt = "",
format_item = function(session)
if not session.modified then
return session.description
local parts = {}

if session.description then
table.insert(parts, session.description)
end

if session.message_count then
table.insert(parts, session.message_count .. " messages")
end

local modified = util.time_ago(session.modified)
return session.description .. " ~ " .. modified
if modified then
table.insert(parts, modified)
end

return table.concat(parts, " ~ ")
end
}, function(session_choice)
cb(session_choice)
Expand Down