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

Method GetDefaultChatModelConfig

coderd/database/dbauthz/dbauthz.go:3353–3364  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

3351}
3352
3353func (q *querier) GetDefaultChatModelConfig(ctx context.Context) (database.ChatModelConfig, error) {
3354 // Reading the default model config is needed for chat creation.
3355 // TODO(CODAGT-161): scope this check when org context is available.
3356 // This function has no org context to scope the check, and
3357 // ResourceDeploymentConfig is too restrictive (admin-only).
3358 // The handler layer gates chat creation via ActionCreate on
3359 // the org-scoped ResourceChat.
3360 if _, ok := ActorFromContext(ctx); !ok {
3361 return database.ChatModelConfig{}, ErrNoActor
3362 }
3363 return q.db.GetDefaultChatModelConfig(ctx)
3364}
3365
3366func (q *querier) GetDefaultOrganization(ctx context.Context) (database.Organization, error) {
3367 return fetch(q.log, q.auth, func(ctx context.Context, _ any) (database.Organization, error) {

Callers

nothing calls this directly

Calls 2

ActorFromContextFunction · 0.70

Tested by

no test coverage detected