Private
Public Access
1
0

Moved api.ChatCompletionProvider, api.Chunk to api/provider

This commit is contained in:
2024-09-30 16:14:11 +00:00
parent a441866f2f
commit 327a128b2f
12 changed files with 153 additions and 152 deletions

View File

@@ -4,6 +4,7 @@ import (
"time"
"git.mlow.ca/mlow/lmcli/pkg/api"
"git.mlow.ca/mlow/lmcli/pkg/api/provider"
"git.mlow.ca/mlow/lmcli/pkg/tui/model"
"github.com/charmbracelet/bubbles/cursor"
"github.com/charmbracelet/bubbles/spinner"
@@ -33,7 +34,7 @@ type (
Err error
}
// sent on each chunk received from LLM
msgChatResponseChunk api.Chunk
msgChatResponseChunk provider.Chunk
// sent on each completed reply
msgChatResponse *api.Message
// sent when the response is canceled
@@ -84,7 +85,7 @@ type Model struct {
editorTarget editorTarget
stopSignal chan struct{}
replyChan chan api.Message
chatReplyChunks chan api.Chunk
chatReplyChunks chan provider.Chunk
persistence bool // whether we will save new messages in the conversation
// UI state
@@ -115,7 +116,7 @@ func Chat(app *model.AppModel) *Model {
stopSignal: make(chan struct{}),
replyChan: make(chan api.Message),
chatReplyChunks: make(chan api.Chunk),
chatReplyChunks: make(chan provider.Chunk),
wrap: true,
selectedMessage: -1,

View File

@@ -199,10 +199,10 @@ func (m *Model) renderMessage(i int) string {
// render the conversation into a string
func (m *Model) conversationMessagesView() string {
sb := strings.Builder{}
m.messageOffsets = make([]int, len(m.App.Messages))
lineCnt := 1
sb := strings.Builder{}
for i, message := range m.App.Messages {
m.messageOffsets[i] = lineCnt
@@ -227,7 +227,6 @@ func (m *Model) conversationMessagesView() string {
sb.WriteString(messageStyle.Width(0).Render(m.replyCursor.View()))
sb.WriteString("\n")
}
return sb.String()
}