mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-08 18:34:59 +01:00
openapi
This commit is contained in:
@@ -83,7 +83,7 @@ var keys = keyMap{
|
||||
key.WithKeys("ctrl+t"),
|
||||
key.WithHelp("ctrl+t", "switch theme"),
|
||||
),
|
||||
|
||||
|
||||
Tools: key.NewBinding(
|
||||
key.WithKeys("f9"),
|
||||
key.WithHelp("f9", "show available tools"),
|
||||
@@ -144,7 +144,7 @@ type appModel struct {
|
||||
|
||||
showMultiArgumentsDialog bool
|
||||
multiArgumentsDialog dialog.MultiArgumentsDialogCmp
|
||||
|
||||
|
||||
showToolsDialog bool
|
||||
toolsDialog dialog.ToolsDialog
|
||||
}
|
||||
@@ -299,11 +299,11 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case dialog.CloseThemeDialogMsg:
|
||||
a.showThemeDialog = false
|
||||
return a, nil
|
||||
|
||||
|
||||
case dialog.CloseToolsDialogMsg:
|
||||
a.showToolsDialog = false
|
||||
return a, nil
|
||||
|
||||
|
||||
case dialog.ShowToolsDialogMsg:
|
||||
a.showToolsDialog = msg.Show
|
||||
return a, nil
|
||||
@@ -436,7 +436,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
a.showThemeDialog = false
|
||||
a.showModelDialog = false
|
||||
a.showFilepicker = false
|
||||
|
||||
|
||||
// Load sessions and show the dialog
|
||||
sessions, err := a.app.Sessions.List(context.Background())
|
||||
if err != nil {
|
||||
@@ -457,7 +457,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
// Close other dialogs
|
||||
a.showToolsDialog = false
|
||||
a.showModelDialog = false
|
||||
|
||||
|
||||
// Show commands dialog
|
||||
if len(a.commands) == 0 {
|
||||
status.Warn("No commands available")
|
||||
@@ -478,7 +478,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
a.showToolsDialog = false
|
||||
a.showThemeDialog = false
|
||||
a.showFilepicker = false
|
||||
|
||||
|
||||
a.showModelDialog = true
|
||||
return a, nil
|
||||
}
|
||||
@@ -489,17 +489,17 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
a.showToolsDialog = false
|
||||
a.showModelDialog = false
|
||||
a.showFilepicker = false
|
||||
|
||||
|
||||
a.showThemeDialog = true
|
||||
return a, a.themeDialog.Init()
|
||||
}
|
||||
return a, nil
|
||||
case key.Matches(msg, keys.Tools):
|
||||
// Check if any other dialog is open
|
||||
if a.currentPage == page.ChatPage && !a.showQuit && !a.showPermissions &&
|
||||
!a.showSessionDialog && !a.showCommandDialog && !a.showThemeDialog &&
|
||||
!a.showFilepicker && !a.showModelDialog && !a.showInitDialog &&
|
||||
!a.showMultiArgumentsDialog {
|
||||
if a.currentPage == page.ChatPage && !a.showQuit && !a.showPermissions &&
|
||||
!a.showSessionDialog && !a.showCommandDialog && !a.showThemeDialog &&
|
||||
!a.showFilepicker && !a.showModelDialog && !a.showInitDialog &&
|
||||
!a.showMultiArgumentsDialog {
|
||||
// Toggle tools dialog
|
||||
a.showToolsDialog = !a.showToolsDialog
|
||||
if a.showToolsDialog {
|
||||
@@ -555,7 +555,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return a, nil
|
||||
}
|
||||
a.showHelp = !a.showHelp
|
||||
|
||||
|
||||
// Close other dialogs if opening help
|
||||
if a.showHelp {
|
||||
a.showToolsDialog = false
|
||||
@@ -574,7 +574,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
a.showFilepicker = !a.showFilepicker
|
||||
a.filepicker.ToggleFilepicker(a.showFilepicker)
|
||||
a.app.SetFilepickerOpen(a.showFilepicker)
|
||||
|
||||
// Close other dialogs if opening filepicker
|
||||
if a.showFilepicker {
|
||||
a.showToolsDialog = false
|
||||
@@ -681,7 +680,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return a, tea.Batch(cmds...)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if a.showToolsDialog {
|
||||
d, toolsCmd := a.toolsDialog.Update(msg)
|
||||
a.toolsDialog = d.(dialog.ToolsDialog)
|
||||
@@ -716,13 +715,13 @@ func getAvailableToolNames(app *app.App) []string {
|
||||
app.History,
|
||||
app.LSPClients,
|
||||
)
|
||||
|
||||
|
||||
// Extract tool names
|
||||
var toolNames []string
|
||||
for _, tool := range allTools {
|
||||
toolNames = append(toolNames, tool.Info().Name)
|
||||
}
|
||||
|
||||
|
||||
return toolNames
|
||||
}
|
||||
|
||||
@@ -931,7 +930,7 @@ func (a appModel) View() string {
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if a.showToolsDialog {
|
||||
overlay := a.toolsDialog.View()
|
||||
row := lipgloss.Height(appView) / 2
|
||||
|
||||
Reference in New Issue
Block a user