( ctx context.Context, store database.Store, chat database.Chat, keys chatprovider.ProviderAPIKeys, )
| 3259 | } |
| 3260 | |
| 3261 | func (p *Server) proposeChatTitleWithStore( |
| 3262 | ctx context.Context, |
| 3263 | store database.Store, |
| 3264 | chat database.Chat, |
| 3265 | keys chatprovider.ProviderAPIKeys, |
| 3266 | ) (string, error) { |
| 3267 | result, err := p.generateManualTitleCandidate(ctx, store, chat, keys) |
| 3268 | if err != nil { |
| 3269 | return "", err |
| 3270 | } |
| 3271 | if !result.hasMessages { |
| 3272 | return "", nil |
| 3273 | } |
| 3274 | |
| 3275 | recordCtx, recordCancel := context.WithTimeout(context.WithoutCancel(ctx), 5*time.Second) |
| 3276 | defer recordCancel() |
| 3277 | if _, recordErr := recordManualTitleUsage( |
| 3278 | recordCtx, |
| 3279 | store, |
| 3280 | chat, |
| 3281 | result.modelConfig, |
| 3282 | result.usage, |
| 3283 | result.activeAPIKeyID, |
| 3284 | "", |
| 3285 | ); recordErr != nil { |
| 3286 | return "", xerrors.Errorf("record manual title usage: %w", recordErr) |
| 3287 | } |
| 3288 | return result.title, nil |
| 3289 | } |
| 3290 | |
| 3291 | func (p *Server) regenerateChatTitleWithStore( |
| 3292 | ctx context.Context, |
no test coverage detected