export type UpdateCopilotConfigDto = {enabled: boolean, modelTemperature: number, maxResponseTokens: number, customSystemPrompt?: (string | null) | undefined, departmentId?: number | undefined, selectedDeskIds?: (Array | null) | undefined}; export type UpdateApiV1AdminCopilotConfigArgs = {body: UpdateCopilotConfigDto}; export type UpdateApiV1AdminCopilotConfigOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upserts the Copilot configuration for the caller's account. DataAnnotations * on Infoset.Types.Models.Admin.UpdateCopilotConfigDto are validated automatically by * `[ApiController]`; invalid payloads return 400 with a structured error. * * PUT /v1/admin/copilot/config * * Also accepts auth: API Key */ export const updateApiV1AdminCopilotConfig = async (args: UpdateApiV1AdminCopilotConfigArgs, options: UpdateApiV1AdminCopilotConfigOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/admin/copilot/config${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };