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

Function AIBridgeModels

coderd/searchquery/search.go:452–479  ·  view source on GitHub ↗
(query string, page codersdk.Pagination)

Source from the content-addressed store, hash-verified

450}
451
452func AIBridgeModels(query string, page codersdk.Pagination) (database.ListAIBridgeModelsParams, []codersdk.ValidationError) {
453 // nolint:exhaustruct // Empty values just means "don't filter by that field".
454 filter := database.ListAIBridgeModelsParams{
455 // #nosec G115 - Safe conversion for pagination offset which is expected to be within int32 range
456 Offset: int32(page.Offset),
457 // #nosec G115 - Safe conversion for pagination limit which is expected to be within int32 range
458 Limit: int32(page.Limit),
459 }
460
461 if query == "" {
462 return filter, nil
463 }
464
465 values, errors := searchTerms(query, func(term string, values url.Values) error {
466 // Defaults to the `model` if no `key:value` pair is provided.
467 values.Add("model", term)
468 return nil
469 })
470 if len(errors) > 0 {
471 return filter, errors
472 }
473
474 parser := httpapi.NewQueryParamParser()
475 filter.Model = parser.String(values, "", "model")
476
477 parser.ErrorExcessParams(values)
478 return filter, parser.Errors
479}
480
481func AIBridgeClients(query string, page codersdk.Pagination) (database.ListAIBridgeClientsParams, []codersdk.ValidationError) {
482 // nolint:exhaustruct // Empty values just means "don't filter by that field".

Callers 1

aiBridgeListModelsMethod · 0.92

Calls 5

StringMethod · 0.95
ErrorExcessParamsMethod · 0.95
NewQueryParamParserFunction · 0.92
searchTermsFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected