Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
work on stream tui, fixes for changes tui
Dane Schneiderf6d772439601
diff --git a/cli/api/methods.go b/cli/api/methods.goindex ab8bf8bc..e31dbc7b 100644--- a/cli/api/methods.go+++ b/cli/api/methods.go@@ -5,6 +5,7 @@ import ("encoding/json""fmt""io"+ "log""net/http""github.com/plandex/plandex/shared"@@ -278,6 +279,7 @@ func (a *Api) DeleteAllPlans(projectId string) error {}func (a *Api) TellPlan(planId string, req shared.TellPlanRequest, onStream OnStreamPlan) error {+serverUrl := fmt.Sprintf("%s/plans/%s/tell", apiHost, planId)reqBytes, err := json.Marshal(req)if err != nil {@@ -294,7 +296,6 @@ func (a *Api) TellPlan(planId string, req shared.TellPlanRequest, onStream OnStrif err != nil {return fmt.Errorf("error sending request: %v", err)}- defer resp.Body.Close()if resp.StatusCode >= 400 {errorBody, _ := io.ReadAll(resp.Body)@@ -302,6 +303,7 @@ func (a *Api) TellPlan(planId string, req shared.TellPlanRequest, onStream OnStr}if req.ConnectStream {+ log.Println("Connecting stream")connectPlanRespStream(resp.Body, onStream)}diff --git a/cli/api/stream.go b/cli/api/stream.goindex 9a94623f..34fc0342 100644--- a/cli/api/stream.go+++ b/cli/api/stream.go@@ -4,8 +4,8 @@ import ("bufio""bytes""context"- "fmt""io"+ "log""github.com/plandex/plandex/shared")@@ -18,13 +18,15 @@ func connectPlanRespStream(body io.ReadCloser, onStream OnStreamPlan) {for {s, err := readUntilSeparator(reader, shared.STREAM_MESSAGE_SEPARATOR)if err != nil {- fmt.Println("Error reading line:", err)+ log.Println("Error reading line:", err)streamState.Event(context.Background(), shared.EVENT_ERROR)onStream(OnStreamPlanParams{Content: "", State: streamState, Err: err})body.Close()return}+ // log.Println("Stream received:", s)+if s == shared.STREAM_FINISHED || s == shared.STREAM_ABORTED {var evt stringif s == shared.STREAM_FINISHED {@@ -34,7 +36,7 @@ func connectPlanRespStream(body io.ReadCloser, onStream OnStreamPlan) {}err := streamState.Event(context.Background(), evt)if err != nil {- fmt.Printf("Error triggering state change %s: %s\n", evt, err)+ log.Printf("Error triggering state change %s: %s\n", evt, err)}onStream(OnStreamPlanParams{Content: "", State: streamState, Err: err})body.Close()@@ -48,7 +50,7 @@ func connectPlanRespStream(body io.ReadCloser, onStream OnStreamPlan) {}if err != nil {- fmt.Println("Error setting state:", err)+ log.Println("Error setting state:", err)onStream(OnStreamPlanParams{Content: "", State: streamState, Err: err})body.Close()returndiff --git a/cli/changes_tui/actions.go b/cli/changes_tui/actions.goindex 815a1eb2..aaa03da3 100644--- a/cli/changes_tui/actions.go+++ b/cli/changes_tui/actions.go@@ -108,7 +108,6 @@ func (m *changesUIModel) scrollDown() {} else if m.newScrollable() {m.changeNewViewport.LineDown(1)}-}func (m *changesUIModel) pageUp() {diff --git a/cli/changes_tui/main_viewport.go b/cli/changes_tui/main_viewport.goindex 21d5b13f..0489164f 100644--- a/cli/changes_tui/main_viewport.go+++ b/cli/changes_tui/main_viewport.go@@ -81,7 +81,7 @@ func (m changesUIModel) renderMainViewHeader() string {if numChanges == 1 {suffix = ""}- header = fmt.Sprintf(" ✅ Final state of %s including %d change%s", m.selectionInfo.currentPath, numChanges, suffix)+ header = fmt.Sprintf(" ✅ Final state of %s (%d change%s)", m.selectionInfo.currentPath, numChanges, suffix)} else {header = fmt.Sprintf(" ✅ New file: %s", m.selectionInfo.currentPath)}diff --git a/cli/changes_tui/replace.go b/cli/changes_tui/replace.goindex b8921467..3e4c686a 100644--- a/cli/changes_tui/replace.go+++ b/cli/changes_tui/replace.go@@ -98,6 +98,9 @@ func (m changesUIModel) getReplacementOldDisplay() oldReplacementRes {oldDisplayContent := toPrepend + oldContent + toAppend+ numLinesPrepended = len(toPrependLines)+ numLinesAppended = len(toAppendLines)+return oldReplacementRes{oldContent,oldDisplayContent,diff --git a/cli/changes_tui/view.go b/cli/changes_tui/view.goindex 60441495..dd025ae4 100644--- a/cli/changes_tui/view.go+++ b/cli/changes_tui/view.go@@ -38,8 +38,8 @@ func (m changesUIModel) getMainViewDims() (int, int) {sidebarWidth := lipgloss.Width(m.renderSidebar())mainViewHeaderHeight := lipgloss.Height(m.renderMainViewHeader())mainViewFooterHeight := lipgloss.Height(m.renderMainViewFooter())- mainViewWidth := m.width - sidebarWidth+ mainViewWidth := m.width - sidebarWidthmainViewHeight := m.height - (helpHeight + tabsHeight)if m.selectedFullFile() {@@ -104,7 +104,7 @@ func (m changesUIModel) renderHelp() string {help += "(←/→) select file • "}- if m.renderSidebar() != "" {+ if m.selectionInfo != nil {help += "(↑/↓) select change • "}@@ -137,14 +137,14 @@ func (m *changesUIModel) scrollReplacementIntoView(oldContent, newContent stringreturn}+ totalLines := view.TotalLineCount()visibleLines := view.VisibleLineCount()contentLines := len(strings.Split(content, "\n"))if contentLines >= (visibleLines - 2) {view.LineDown(numLinesPrepended - 2)} else {- diffAround := visibleLines - contentLines- toScroll := numLinesPrepended - diffAround/2+ toScroll := getSnippetScrollPosition(totalLines, visibleLines, numLinesPrepended, contentLines)view.LineDown(toScroll)}}@@ -156,3 +156,17 @@ func (m *changesUIModel) scrollReplacementIntoView(oldContent, newContent stringscrollView(newContent, &m.changeNewViewport)}}++func getSnippetScrollPosition(totalLines, viewportHeight, snippetLineIndex, snippetHeight int) int {+ snippetMiddleLine := snippetLineIndex + snippetHeight/2+ viewportMiddleLine := viewportHeight / 2++ // Initial target scroll position+ scrollPosition := snippetMiddleLine - viewportMiddleLine++ // Adjust for bounds+ scrollPosition = max(scrollPosition, 0) // Adjust for top bound+ scrollPosition = min(scrollPosition, totalLines-viewportHeight) // Adjust for bottom bound++ return scrollPosition+}diff --git a/cli/cmd/continue.go b/cli/cmd/continue.goindex 1e711880..f0d0a747 100644--- a/cli/cmd/continue.go+++ b/cli/cmd/continue.go@@ -27,12 +27,11 @@ var nextCmd = &cobra.Command{func init() {RootCmd.AddCommand(nextCmd)- tellCmd.Flags().BoolVar(&continueBg, "bg", false, "Execute autonomously in the background")+ nextCmd.Flags().BoolVar(&continueBg, "bg", false, "Execute autonomously in the background")}func next(cmd *cobra.Command, args []string) {lib.MustResolveProject()-lib.MustCheckOutdatedContextWithOutput()err := api.Client.TellPlan(lib.CurrentPlanId, shared.TellPlanRequest{diff --git a/cli/cmd/tell.go b/cli/cmd/tell.goindex f081b67f..ccf107ba 100644--- a/cli/cmd/tell.go+++ b/cli/cmd/tell.go@@ -2,6 +2,7 @@ package cmdimport ("fmt"+ "log""os""os/exec""plandex/api"@@ -38,6 +39,8 @@ func init() {}func tell(cmd *cobra.Command, args []string) {+ lib.MustResolveProject()+var prompt stringif len(args) > 0 {@@ -117,6 +120,19 @@ func tell(cmd *cobra.Command, args []string) {lib.MustCheckOutdatedContextWithOutput()+ if !tellBg {+ go func() {+ err := streamtui.StartStreamUI()++ if err != nil {+ fmt.Fprintln(os.Stderr, "Error starting stream UI:", err)+ os.Exit(1)+ }++ os.Exit(0)+ }()+ }+err := api.Client.TellPlan(lib.CurrentPlanId, shared.TellPlanRequest{Prompt: prompt,ConnectStream: !tellBg,@@ -126,14 +142,15 @@ func tell(cmd *cobra.Command, args []string) {return}- if !tellBg {- err = streamtui.StartStreamUI()+ log.Println("Prompt sent")- if err != nil {- fmt.Fprintln(os.Stderr, "Error starting stream UI:", err)- return- }+ if tellBg {+ fmt.Println("✅ Prompt sent")+ } else {+ // Wait for stream UI to quit+ select {}}+}func prepareEditorCommand(editor string, filename string) *exec.Cmd {diff --git a/cli/go.mod b/cli/go.modindex bf4ab0bc..4ee3b11f 100644--- a/cli/go.mod+++ b/cli/go.mod@@ -5,6 +5,7 @@ go 1.21.3require (github.com/atotto/clipboard v0.1.4github.com/charmbracelet/lipgloss v0.9.1+ github.com/davecgh/go-spew v1.1.1github.com/fatih/color v1.16.0github.com/looplab/fsm v1.0.1github.com/muesli/reflow v0.3.0@@ -54,7 +55,6 @@ require (github.com/mattn/go-runewidth v0.0.15 // indirectgithub.com/pkoukk/tiktoken-go v0.1.6 // indirectgithub.com/plandex/plandex/shared v0.0.0-00010101000000-000000000000- github.com/sashabaranov/go-openai v1.17.7github.com/spf13/pflag v1.0.5 // indirectgolang.org/x/text v0.14.0 // indirect)diff --git a/cli/go.sum b/cli/go.sumindex 2d8c04bd..bfcd19f4 100644--- a/cli/go.sum+++ b/cli/go.sum@@ -630,8 +630,6 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFogithub.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b18R55ulyQ/h3RaWyloPyER7fWQVZvimKKhnI5OfrJQ=github.com/sagikazarmark/crypt v0.8.0/go.mod h1:TmKwZAo97S4Fy4sfMH/HX/cQP5D+ijra2NyLpNNmttY=github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=-github.com/sashabaranov/go-openai v1.17.7 h1:MPcAwlwbeo7ZmhQczoOgZBHtIBY1TfZqsdx6+/ndloM=-github.com/sashabaranov/go-openai v1.17.7/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=diff --git a/cli/lib/stream.go b/cli/lib/stream.goindex 2235a7da..7771b590 100644--- a/cli/lib/stream.go+++ b/cli/lib/stream.go@@ -11,7 +11,6 @@ import ()var OnStreamPlan api.OnStreamPlan = func(params api.OnStreamPlanParams) {-switch params.State.Current() {case shared.STATE_REPLYING:streamtui.Send(types.StreamTUIUpdate{diff --git a/cli/main.go b/cli/main.goindex e217051a..28548233 100644--- a/cli/main.go+++ b/cli/main.go@@ -30,6 +30,8 @@ func init() {// Set the output of the logger to the filelog.SetOutput(file)++ log.Println("Starting Plandex - logging initialized")}func main() {diff --git a/cli/stream_tui/model.go b/cli/stream_tui/model.goindex dc098c36..d85e4149 100644--- a/cli/stream_tui/model.go+++ b/cli/stream_tui/model.go@@ -1,8 +1,6 @@package streamtuiimport (- "time"-bubbleKey "github.com/charmbracelet/bubbles/key""github.com/charmbracelet/bubbles/spinner""github.com/charmbracelet/bubbles/viewport"@@ -13,9 +11,8 @@ import (type streamUIModel struct {keymap keymap- reply string- replyDisplay string- replyDisplayUpdatedAt time.Time+ reply string+ replyDisplay stringreplyViewport viewport.Model@@ -32,6 +29,11 @@ type streamUIModel struct {}type keymap = struct {+ stop,+ scrollUp,+ scrollDown,+ pageUp,+ pageDown,quit bubbleKey.Binding}@@ -46,9 +48,32 @@ func initialModel() *streamUIModel {initialState := streamUIModel{keymap: keymap{+ stop: bubbleKey.NewBinding(+ bubbleKey.WithKeys("s"),+ bubbleKey.WithHelp("s", "stop"),+ ),++ scrollDown: bubbleKey.NewBinding(+ bubbleKey.WithKeys("j"),+ bubbleKey.WithHelp("j", "scroll down"),+ ),++ scrollUp: bubbleKey.NewBinding(+ bubbleKey.WithKeys("k"),+ bubbleKey.WithHelp("k", "scroll up"),+ ),++ pageDown: bubbleKey.NewBinding(+ bubbleKey.WithKeys("J", "pageDown"),+ bubbleKey.WithHelp("J", "page down"),+ ),++ pageUp: bubbleKey.NewBinding(+ bubbleKey.WithKeys("K", "pageUp"),+ bubbleKey.WithHelp("K", "page up"),+ ),quit: bubbleKey.NewBinding(- bubbleKey.WithKeys("q", "ctrl+c"),- bubbleKey.WithHelp("q", "quit"),+ bubbleKey.WithKeys("ctrl+c"),),},diff --git a/cli/stream_tui/run.go b/cli/stream_tui/run.goindex 150fa303..95bfb1af 100644--- a/cli/stream_tui/run.go+++ b/cli/stream_tui/run.go@@ -3,16 +3,20 @@ package streamtuiimport ("fmt""log"+ "sync"tea "github.com/charmbracelet/bubbletea")var ui *tea.Program+var mu sync.Mutexfunc StartStreamUI() error {initial := initialModel()+ mu.Lock()ui = tea.NewProgram(initial, tea.WithAltScreen())+ mu.Unlock()_, err := ui.Run()@@ -28,6 +32,8 @@ func Quit() {log.Println("stream ui is nil, can't quit")return}+ mu.Lock()+ defer mu.Unlock()ui.Quit()}@@ -36,6 +42,7 @@ func Send(msg tea.Msg) {log.Println("stream ui is nil, can't send message")return}-+ mu.Lock()+ defer mu.Unlock()ui.Send(msg)}diff --git a/cli/stream_tui/update.go b/cli/stream_tui/update.goindex bb57fbef..62109b22 100644--- a/cli/stream_tui/update.go+++ b/cli/stream_tui/update.go@@ -1,10 +1,8 @@package streamtuiimport (- "log""plandex/term""plandex/types"- "time"bubbleKey "github.com/charmbracelet/bubbles/key""github.com/charmbracelet/bubbles/spinner"@@ -13,10 +11,7 @@ import ("github.com/charmbracelet/lipgloss")-const displayThrottle = 150 * time.Millisecond--func (m streamUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {-+func (m *streamUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {switch msg := msg.(type) {case spinner.TickMsg:@@ -30,43 +25,20 @@ func (m streamUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {m.windowResized(msg.Width, msg.Height)case types.StreamTUIUpdate:- now := time.Now()-- if msg.PlanTokenCount != nil {- m.processing = false- m.building = true-- if m.replyDisplay != m.reply {- m.updateReplyDisplay(now)- }-- m.tokensByPath[msg.PlanTokenCount.Path] += msg.PlanTokenCount.NumTokens- if msg.PlanTokenCount.Finished {- m.finishedByPath[msg.PlanTokenCount.Path] = true- }- } else if msg.ReplyChunk != "" {- m.processing = false-- elapsed := now.Sub(m.replyDisplayUpdatedAt)-- m.reply += msg.ReplyChunk-- if elapsed >= displayThrottle {- m.updateReplyDisplay(now)- }-- } else if msg.Processing {- m.processing = true- if m.replyDisplay != m.reply {- m.updateReplyDisplay(now)- }- return m, m.spinner.Tick- }+ return m.streamUpdate(&msg)case tea.KeyMsg:switch {case bubbleKey.Matches(msg, m.keymap.quit):return m, tea.Quit+ case bubbleKey.Matches(msg, m.keymap.scrollDown):+ m.scrollDown()+ case bubbleKey.Matches(msg, m.keymap.scrollUp):+ m.scrollUp()+ case bubbleKey.Matches(msg, m.keymap.pageDown):+ m.pageDown()+ case bubbleKey.Matches(msg, m.keymap.pageUp):+ m.pageUp()}}@@ -76,24 +48,90 @@ func (m streamUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {func (m *streamUIModel) windowResized(w, h int) {m.width = wm.height = h++ _, viewportHeight := m.getViewportDimensions()+if m.ready {- m.replyViewport.Width = w- m.replyViewport.Height = h+ m.updateViewportDimensions()} else {- m.replyViewport = viewport.New(w, h)+ m.replyViewport = viewport.New(w, viewportHeight)m.replyViewport.Style = lipgloss.NewStyle().Padding(0, 1, 0, 1)m.ready = true}}-func (m *streamUIModel) updateReplyDisplay(now time.Time) {- m.replyDisplay = m.reply- md, err := term.GetMarkdown(m.reply)- if err != nil {- log.Println("error parsing markdown:", err)- return+func (m *streamUIModel) updateReplyDisplay() {+ md, _ := term.GetMarkdown(m.reply)+ m.replyDisplay = md+ m.replyViewport.SetContent(md)+ m.updateViewportDimensions()+}++func (m *streamUIModel) updateViewportDimensions() {+ w, h := m.getViewportDimensions()+ m.replyViewport.Width = w+ m.replyViewport.Height = h+}++func (m *streamUIModel) getViewportDimensions() (int, int) {+ w := m.width+ h := m.height++ helpHeight := lipgloss.Height(m.renderHelp())+ buildHeight := lipgloss.Height(m.renderBuild())+ processingHeight := lipgloss.Height(m.renderProcessing())+ maxViewportHeight := h - (helpHeight + buildHeight + processingHeight)+ viewportHeight := min(maxViewportHeight, lipgloss.Height(m.replyDisplay))++ return w, viewportHeight+}++func (m streamUIModel) replyScrollable() bool {+ return m.replyViewport.TotalLineCount() > m.replyViewport.VisibleLineCount()+}++func (m *streamUIModel) scrollDown() {+ if m.replyScrollable() {+ m.replyViewport.LineDown(1)}+}- m.replyViewport.SetContent(md)- m.replyDisplayUpdatedAt = now+func (m *streamUIModel) scrollUp() {+ if m.replyScrollable() {+ m.replyViewport.LineUp(1)+ }+}++func (m *streamUIModel) pageDown() {+ if m.replyScrollable() {+ m.replyViewport.ViewDown()+ }+}++func (m *streamUIModel) pageUp() {+ if m.replyScrollable() {+ m.replyViewport.ViewUp()+ }+}++func (m *streamUIModel) streamUpdate(msg *types.StreamTUIUpdate) (tea.Model, tea.Cmd) {+ if msg.PlanTokenCount != nil {+ m.processing = false+ m.building = true++ m.tokensByPath[msg.PlanTokenCount.Path] += msg.PlanTokenCount.NumTokens+ if msg.PlanTokenCount.Finished {+ m.finishedByPath[msg.PlanTokenCount.Path] = true+ }+ } else if msg.ReplyChunk != "" {+ m.processing = false+ m.reply += msg.ReplyChunk+ m.updateReplyDisplay()++ } else if msg.Processing {+ m.processing = true+ return m, m.spinner.Tick+ }++ return m, nil}diff --git a/cli/stream_tui/view.go b/cli/stream_tui/view.goindex ea392cbf..c68a92d6 100644--- a/cli/stream_tui/view.go+++ b/cli/stream_tui/view.go@@ -25,14 +25,14 @@ func (m streamUIModel) renderMainView() string {}func (m streamUIModel) renderHelp() string {- style := lipgloss.NewStyle().Width(m.width).Foreground(lipgloss.Color(helpTextColor)).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))+ style := lipgloss.NewStyle().Width(m.width).Foreground(lipgloss.Color(helpTextColor)).BorderStyle(lipgloss.NormalBorder()).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))- return style.Render("(s)top")+ return style.Render(" (s)top")}func (m streamUIModel) renderProcessing() string {if m.processing {- style := lipgloss.NewStyle().Width(m.width).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))+ style := lipgloss.NewStyle().Width(m.width).BorderStyle(lipgloss.NormalBorder()).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))return style.Render(m.spinner.View())} else {@@ -45,11 +45,12 @@ func (m streamUIModel) renderBuild() string {return ""}- style := lipgloss.NewStyle().Width(m.width).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))+ style := lipgloss.NewStyle().Width(m.width).BorderStyle(lipgloss.NormalBorder()).BorderTop(true).BorderForeground(lipgloss.Color(borderColor))head := color.New(color.BgGreen, color.FgHiWhite, color.Bold).Sprint(" 🏗 ") + color.New(color.BgGreen, color.FgHiWhite).Sprint("Building plan ")var lines []string+ lines = append(lines, head)for filePath, tokens := range m.tokensByPath {finished := m.finishedByPath[filePath]line := fmt.Sprintf(" 📄 %s", filePath)@@ -62,5 +63,5 @@ func (m streamUIModel) renderBuild() string {lines = append(lines, line)}- return style.Render(head + strings.Join(lines, "\n"))+ return style.Render(strings.Join(lines, "\n"))}diff --git a/server/handlers/plans_exec.go b/server/handlers/plans_exec.goindex ffbef332..f64d7df5 100644--- a/server/handlers/plans_exec.go+++ b/server/handlers/plans_exec.go@@ -31,7 +31,10 @@ func TellPlanHandler(w http.ResponseWriter, r *http.Request) {http.Error(w, "Error reading request body", http.StatusInternalServerError)return}- defer r.Body.Close()+ defer func() {+ log.Println("Closing request body")+ r.Body.Close()+ }()var requestBody shared.TellPlanRequestif err := json.Unmarshal(body, &requestBody); err != nil {diff --git a/server/handlers/stream_helper.go b/server/handlers/stream_helper.goindex 66db2275..f0617212 100644--- a/server/handlers/stream_helper.go+++ b/server/handlers/stream_helper.go@@ -9,6 +9,8 @@ import ()func startResponseStream(w http.ResponseWriter, ch chan string, ctx context.Context, closeFn func()) {+ log.Println("Response stream manager: starting plan stream")+w.Header().Set("Transfer-Encoding", "chunked")w.Header().Set("Content-Type", "text/plain; charset=utf-8")@@ -23,6 +25,8 @@ func startResponseStream(w http.ResponseWriter, ch chan string, ctx context.Contlog.Println("Response stream manager: context done")returncase msg := <-ch:+ log.Println("Response stream manager: sending message:", msg)+bytes := []byte(msg + shared.STREAM_MESSAGE_SEPARATOR)_, err := w.Write(bytes)if err != nil {diff --git a/server/model/name.go b/server/model/name.goindex 71cc1ea5..5acc96ad 100644--- a/server/model/name.go+++ b/server/model/name.go@@ -43,14 +43,14 @@ func GenPlanName(planContent string) (string, error) {for _, choice := range resp.Choices {if choice.FinishReason == "function_call" &&choice.Message.FunctionCall != nil &&- choice.Message.FunctionCall.Name == "describePlan" {+ choice.Message.FunctionCall.Name == "namePlan" {fnCall := choice.Message.FunctionCallres = fnCall.Arguments}}if res == "" {- fmt.Println("no describePlan function call found in response")+ fmt.Println("no namePlan function call found in response")return "", err}diff --git a/server/types/active_plan.go b/server/types/active_plan.goindex a8b96eb2..16b3eb4f 100644--- a/server/types/active_plan.go+++ b/server/types/active_plan.go@@ -49,9 +49,7 @@ func NewActivePlan(prompt string) *ActivePlan {returncase msg := <-active.StreamCh:for _, ch := range active.subscriptions {- go func(ch chan string) {- ch <- msg- }(ch)+ ch <- msg}}}