mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-03 07:55:05 +01:00
wip: tui api
This commit is contained in:
@@ -486,7 +486,9 @@ func (m *editorComponent) SetValueWithAttachments(value string) {
|
||||
|
||||
if end > start {
|
||||
filePath := value[start:end]
|
||||
if _, err := os.Stat(filePath); err == nil {
|
||||
slog.Debug("test", "filePath", filePath)
|
||||
if _, err := os.Stat(filepath.Join(m.app.Info.Path.Cwd, filePath)); err == nil {
|
||||
slog.Debug("test", "found", true)
|
||||
attachment := m.createAttachmentFromFile(filePath)
|
||||
if attachment != nil {
|
||||
m.textarea.InsertAttachment(attachment)
|
||||
|
||||
@@ -509,13 +509,13 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "/tui/open-help":
|
||||
helpDialog := dialog.NewHelpDialog(a.app)
|
||||
a.modal = helpDialog
|
||||
case "/tui/prompt":
|
||||
case "/tui/append-prompt":
|
||||
var body struct {
|
||||
Text string `json:"text"`
|
||||
Parts []opencode.Part `json:"parts"`
|
||||
}
|
||||
json.Unmarshal((msg.Body), &body)
|
||||
a.editor.SetValue(body.Text)
|
||||
a.editor.SetValueWithAttachments(strings.TrimRight(a.editor.Value(), " ") + " " + body.Text + " ")
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user