MCPcopy Index your code
hub / github.com/coder/coder / ProposeChatTitle

Method ProposeChatTitle

coderd/x/chatd/chatd.go:3111–3131  ·  view source on GitHub ↗

ProposeChatTitle generates a title suggestion from the chat's visible messages without persisting it.

(
	ctx context.Context,
	chat database.Chat,
)

Source from the content-addressed store, hash-verified

3109
3110// ProposeChatTitle generates a title suggestion from the chat's visible messages without persisting it.
3111func (p *Server) ProposeChatTitle(
3112 ctx context.Context,
3113 chat database.Chat,
3114) (string, error) {
3115 //nolint:gocritic // Non-admin users need chatd-scoped config reads here.
3116 chatdCtx := dbauthz.AsChatd(ctx)
3117 keys, err := p.resolveUserProviderAPIKeys(chatdCtx, chat.OwnerID, uuid.Nil)
3118 if err != nil {
3119 keys = chatprovider.ProviderAPIKeys{}
3120 }
3121 if err := p.acquireManualTitleLock(ctx, chat.ID); err != nil {
3122 return "", err
3123 }
3124 defer p.releaseManualTitleLock(chatdCtx, chat.ID)
3125
3126 title, err := p.proposeChatTitleWithStore(chatdCtx, p.db, chat, keys)
3127 if err != nil {
3128 return "", p.recordManualTitleGenerationFailure(ctx, chat, err)
3129 }
3130 return title, nil
3131}
3132
3133func (p *Server) recordManualTitleGenerationFailure(
3134 ctx context.Context,

Calls 6

AsChatdFunction · 0.92