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

Method recordManualTitleGenerationFailure

coderd/x/chatd/chatd.go:3133–3164  ·  view source on GitHub ↗
(
	ctx context.Context,
	chat database.Chat,
	err error,
)

Source from the content-addressed store, hash-verified

3131}
3132
3133func (p *Server) recordManualTitleGenerationFailure(
3134 ctx context.Context,
3135 chat database.Chat,
3136 err error,
3137) error {
3138 var generationErr *manualTitleGenerationError
3139 if !errors.As(err, &generationErr) {
3140 return err
3141 }
3142
3143 //nolint:gocritic // Failure accounting still needs chatd-scoped config reads.
3144 recordCtx, recordCancel := context.WithTimeout(
3145 dbauthz.AsChatd(context.WithoutCancel(ctx)),
3146 5*time.Second,
3147 )
3148 defer recordCancel()
3149 if _, recordErr := recordManualTitleUsage(
3150 recordCtx,
3151 p.db,
3152 chat,
3153 generationErr.modelConfig,
3154 generationErr.usage,
3155 generationErr.activeAPIKeyID,
3156 "",
3157 ); recordErr != nil {
3158 return errors.Join(
3159 generationErr,
3160 xerrors.Errorf("record manual title usage: %w", recordErr),
3161 )
3162 }
3163 return generationErr
3164}
3165
3166// generateManualTitleCandidate performs only model generation and returns the
3167// candidate plus accounting metadata. Endpoint-specific commit paths are

Callers 2

RegenerateChatTitleMethod · 0.95
ProposeChatTitleMethod · 0.95

Calls 4

AsChatdFunction · 0.92
recordManualTitleUsageFunction · 0.85
AsMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected