Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Added support for managing AI models within the AI assistant settings. - Introduced new hosted mail setup component for streamlined email configuration. - Updated environment variables for local development and proxy settings. - Enhanced error handling and user feedback in the chat page for API connectivity issues. - Improved routing for AI-related API calls in the Next.js configuration. - Added documentation for local development and agent management in CLAUDE.md.
25 lines
795 B
TypeScript
25 lines
795 B
TypeScript
"use client"
|
|
|
|
import { useMutation } from "@tanstack/react-query"
|
|
import { apiClient } from "@/lib/api/client"
|
|
import type { ApiLLMModelsResponse } from "@/lib/contacts/discovery-types"
|
|
|
|
export function useDiscoverOrgLLMModels() {
|
|
return useMutation({
|
|
mutationFn: (providerId: string) =>
|
|
apiClient.post<ApiLLMModelsResponse>("/admin/org/llm/discover-models", {
|
|
provider_id: providerId,
|
|
}),
|
|
})
|
|
}
|
|
|
|
export function isOrgLLMProviderKeyConfigured(
|
|
secrets: Record<string, unknown> | undefined,
|
|
providerId: string,
|
|
): boolean {
|
|
const llmProviders = secrets?.llm_providers
|
|
if (!llmProviders || typeof llmProviders !== "object") return false
|
|
const entry = (llmProviders as Record<string, { configured?: boolean }>)[providerId]
|
|
return entry?.configured === true
|
|
}
|