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

Function createChatProviderConfig

site/src/api/queries/chats.ts:1776–1792  ·  view source on GitHub ↗
(queryClient: QueryClient)

Source from the content-addressed store, hash-verified

1774};
1775
1776export const createChatProviderConfig = (queryClient: QueryClient) => ({
1777 mutationFn: (req: TypesGen.CreateChatProviderConfigRequest) => {
1778 const providerType = normalizeAIProviderType(req.provider);
1779 const apiKey = req.api_key;
1780 return API.experimental.createAIProvider({
1781 type: providerType,
1782 name: generatedAIProviderName(providerType),
1783 display_name: req.display_name || formatProviderLabel(providerType),
1784 base_url: req.base_url ?? "",
1785 enabled: req.enabled ?? true,
1786 api_keys: apiKey ? [apiKey] : undefined,
1787 });
1788 },
1789 onSuccess: async () => {
1790 await invalidateChatConfigurationQueries(queryClient);
1791 },
1792});
1793
1794type UpdateChatProviderConfigMutationArgs = {
1795 providerConfigId: string;

Callers 2

AgentSettingsModelsPageFunction · 0.90

Calls 4

formatProviderLabelFunction · 0.90
normalizeAIProviderTypeFunction · 0.85
generatedAIProviderNameFunction · 0.85

Tested by

no test coverage detected