@@ -163,7 +163,9 @@ func (a *agent) generateTitle(ctx context.Context, sessionID string, content str
163 return err
163 return err
165 parts := []message.ContentPart{message.TextContent{Text: content}}
165 parts := []message.ContentPart{message.TextContent{Text: content}}
167+ // Use streaming approach like summarization
166− response, err := a.titleProvider.SendMessages(
168+ response := a.titleProvider.StreamResponse(
168 []message.Message{
170 []message.Message{
@@ -173,11 +175,20 @@ func (a *agent) generateTitle(ctx context.Context, sessionID string, content str
174 make([]tools.BaseTool, 0),
176 make([]tools.BaseTool, 0),
179+ var finalResponse *provider.ProviderResponse
180+ for r := range response {
176− if err != nil {
181+ if r.Error != nil {
177− return err
182+ return r.Error
184+ finalResponse = r.Response
187+ if finalResponse == nil {
188+ return fmt.Errorf("no response received from title provider")
180− title := strings.TrimSpace(strings.ReplaceAll(response.Content, "\n", " "))
191+ title := strings.TrimSpace(strings.ReplaceAll(finalResponse.Content, "\n", " "))
181 if title == "" {
192 if title == "" {
182 return nil
193 return nil