diff options
| author | Dax <[email protected]> | 2025-07-18 13:42:50 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-18 13:42:50 -0400 |
| commit | d56dec4ba7867670d9a7dae2a535d38d59f24efb (patch) | |
| tree | f10cde4e4aad0bc6d882266bdef96948251375f4 /packages/tui/internal | |
| parent | c952e9ae3d74dcdda2a4fbdfef19b42c49096026 (diff) | |
| download | opencode-d56dec4ba7867670d9a7dae2a535d38d59f24efb.tar.gz opencode-d56dec4ba7867670d9a7dae2a535d38d59f24efb.zip | |
wip: optional IDs in api (#1128)
Diffstat (limited to 'packages/tui/internal')
| -rw-r--r-- | packages/tui/internal/app/app.go | 28 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/editor.go | 6 |
2 files changed, 15 insertions, 19 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 57d9f98a3..8f7e27935 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -63,7 +63,7 @@ type SessionClearedMsg struct{} type CompactSessionMsg struct{} type SendMsg struct { Text string - Attachments []opencode.FilePartParam + Attachments []opencode.FilePartInputParam } type SetEditorContentMsg struct { Text string @@ -462,7 +462,7 @@ func (a *App) CreateSession(ctx context.Context) (*opencode.Session, error) { func (a *App) SendChatMessage( ctx context.Context, text string, - attachments []opencode.FilePartParam, + attachments []opencode.FilePartInputParam, ) (*App, tea.Cmd) { var cmds []tea.Cmd if a.Session.ID == "" { @@ -511,22 +511,18 @@ func (a *App) SendChatMessage( for _, part := range parts { switch casted := part.(type) { case opencode.TextPart: - partsParam = append(partsParam, opencode.TextPartParam{ - ID: opencode.F(casted.ID), - MessageID: opencode.F(casted.MessageID), - SessionID: opencode.F(casted.SessionID), - Type: opencode.F(casted.Type), - Text: opencode.F(casted.Text), + partsParam = append(partsParam, opencode.TextPartInputParam{ + ID: opencode.F(casted.ID), + Type: opencode.F(opencode.TextPartInputType(casted.Type)), + Text: opencode.F(casted.Text), }) case opencode.FilePart: - partsParam = append(partsParam, opencode.FilePartParam{ - ID: opencode.F(casted.ID), - Mime: opencode.F(casted.Mime), - MessageID: opencode.F(casted.MessageID), - SessionID: opencode.F(casted.SessionID), - Type: opencode.F(casted.Type), - URL: opencode.F(casted.URL), - Filename: opencode.F(casted.Filename), + partsParam = append(partsParam, opencode.FilePartInputParam{ + ID: opencode.F(casted.ID), + Mime: opencode.F(casted.Mime), + Type: opencode.F(opencode.FilePartInputType(casted.Type)), + URL: opencode.F(casted.URL), + Filename: opencode.F(casted.Filename), }) } } diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go index 3db6fa80f..687553342 100644 --- a/packages/tui/internal/components/chat/editor.go +++ b/packages/tui/internal/components/chat/editor.go @@ -306,10 +306,10 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) { var cmds []tea.Cmd attachments := m.textarea.GetAttachments() - fileParts := make([]opencode.FilePartParam, 0) + fileParts := make([]opencode.FilePartInputParam, 0) for _, attachment := range attachments { - fileParts = append(fileParts, opencode.FilePartParam{ - Type: opencode.F(opencode.FilePartTypeFile), + fileParts = append(fileParts, opencode.FilePartInputParam{ + Type: opencode.F(opencode.FilePartInputTypeFile), Mime: opencode.F(attachment.MediaType), URL: opencode.F(attachment.URL), Filename: opencode.F(attachment.Filename), |
