diff --git a/src/app/api/apps/index.ts b/src/app/api/apps/index.ts index c241f7af..16e78acb 100644 --- a/src/app/api/apps/index.ts +++ b/src/app/api/apps/index.ts @@ -16,7 +16,7 @@ import { client } from '../client'; import { assertSuccessResponse, getRequestHeaders } from '../utils'; -import { ChatCompletionCreateBody } from './types'; +import { ChatCompletionCreateBody, ChatCompletionResponse } from './types'; export async function createChatCompletion( organizationId: string, @@ -28,7 +28,7 @@ export async function createChatCompletion( headers: getRequestHeaders(organizationId, projectId), }); assertSuccessResponse(res); - return res.data; + return res.data as ChatCompletionResponse; } export async function modulesToPackages( diff --git a/src/app/api/types.ts b/src/app/api/types.ts index 338dc8db..52fa6739 100644 --- a/src/app/api/types.ts +++ b/src/app/api/types.ts @@ -45,7 +45,7 @@ export type ApiMetadata = { }; export type EntityResultWithMetadata = Omit & { - metadata?: ApiMetadata; + metadata?: ApiMetadata | null; }; export type EntityWithEncodedMetadata = Omit & { diff --git a/src/app/api/utils.ts b/src/app/api/utils.ts index 7fa38297..748e2477 100644 --- a/src/app/api/utils.ts +++ b/src/app/api/utils.ts @@ -99,7 +99,7 @@ export function encodeMetadata( } export function decodeMetadata( - metadata?: ApiMetadata, + metadata?: ApiMetadata | null, ): T { const decoded: EntityMetadata = {}; diff --git a/src/modules/tools/manage/UserToolModal.tsx b/src/modules/tools/manage/UserToolModal.tsx index f3142ae6..85289f56 100644 --- a/src/modules/tools/manage/UserToolModal.tsx +++ b/src/modules/tools/manage/UserToolModal.tsx @@ -390,7 +390,7 @@ export function UserToolModal({ ); } -function ApiAuthenticationMethod({ tool }: { tool: Tool }) { +function ApiAuthenticationMethod({ tool }: { tool?: Tool }) { const [editApiKey, setEditApiKey] = useState(false); const id = useId(); const {