-
Couldn't load subscription status.
- Fork 150
Slash commands #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slash commands #519
Conversation
Signed-off-by: Jean-Laurent de Morlhon <jeanlaurent@morlhon.net>
5065be3 to
0752e62
Compare
|
Is this supposed to resolve #517? I'm not sure if /copy and /clipboard have the same meaning or if I'm missing some other detail |
|
Yes /clipboard might not be the best named function |
|
|
||
| // handleSlashCommand checks if the content is a slash command and handles it | ||
| // Returns (true, cmd) if command was handled, (false, nil) otherwise | ||
| func (p *chatPage) handleSlashCommand(content string) (bool, tea.Cmd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These commands already exist in the tui.go
Lines 293 to 333 in 6055909
| func (a *appModel) buildCommandCategories() []dialog.CommandCategory { | |
| return []dialog.CommandCategory{ | |
| { | |
| Name: "Session", | |
| Commands: []dialog.Command{ | |
| { | |
| ID: "session.new", | |
| Label: "New ", | |
| Description: "Start a new conversation", | |
| Category: "Session", | |
| Execute: func() tea.Cmd { | |
| a.application.NewSession() | |
| a.chatPage = chatpage.New(a.application) | |
| a.dialog = dialog.New() | |
| a.statusBar = statusbar.New(a.chatPage) | |
| return tea.Batch(a.Init(), a.handleWindowResize(a.wWidth, a.wHeight)) | |
| }, | |
| }, | |
| { | |
| ID: "session.compact", | |
| Label: "Compact", | |
| Description: "Summarize the current conversation", | |
| Category: "Session", | |
| Execute: func() tea.Cmd { | |
| return a.chatPage.CompactSession() | |
| }, | |
| }, | |
| { | |
| ID: "session.clipboard", | |
| Label: "Copy", | |
| Description: "Copy the current conversation to the clipboard", | |
| Category: "Session", | |
| Execute: func() tea.Cmd { | |
| return a.chatPage.CopySessionToClipboard() | |
| }, | |
| }, | |
| }, | |
| }, | |
| } | |
| } |
We should reuse them
|
@jeanlaurent @rumpl What's the status on this one? |
|
@jeanlaurent I'm going to close this one. There are other PRs that try to address that |
The only way to copy from the clipboard is through CMD-P then select copy.
This adds
/copy,/reset and/compact` commands in all modes (including --tui=false).Fixes #517