@strapi/content-type-builder 5.42.1 → 5.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/AIChat/hooks/useAIFetch.js +1 -1
- package/dist/admin/components/AIChat/hooks/useAIFetch.js.map +1 -1
- package/dist/admin/components/AIChat/hooks/useAIFetch.mjs +2 -2
- package/dist/admin/components/AIChat/hooks/useAIFetch.mjs.map +1 -1
- package/dist/admin/translations/cs.json.js +158 -2
- package/dist/admin/translations/cs.json.js.map +1 -1
- package/dist/admin/translations/cs.json.mjs +158 -2
- package/dist/admin/translations/cs.json.mjs.map +1 -1
- package/dist/admin/translations/nl.json.js +100 -38
- package/dist/admin/translations/nl.json.js.map +1 -1
- package/dist/admin/translations/nl.json.mjs +100 -38
- package/dist/admin/translations/nl.json.mjs.map +1 -1
- package/dist/admin/translations/zh-Hans.json.js +215 -215
- package/dist/admin/translations/zh-Hans.json.mjs +215 -215
- package/dist/server/register.js +2 -3
- package/dist/server/register.js.map +1 -1
- package/dist/server/register.mjs +2 -3
- package/dist/server/register.mjs.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -22,7 +22,7 @@ const CHAT_TOO_LONG_ERROR = 'Chat too long';
|
|
|
22
22
|
const strapiVersion = strapiAdmin.useAppInfo('useAIFetch', (state)=>state.strapiVersion);
|
|
23
23
|
const projectId = strapiAdmin.useAppInfo('useAIFetch', (state)=>state.projectId);
|
|
24
24
|
const userId = strapiAdmin.useAppInfo('useAIFetch-user', (state)=>state.userId);
|
|
25
|
-
const aiUsage = ee.
|
|
25
|
+
const aiUsage = ee.useGetAiUsageQuery(undefined, {
|
|
26
26
|
refetchOnMountOrArgChange: true
|
|
27
27
|
});
|
|
28
28
|
const [isPending, setIsPending] = React.useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAIFetch.js","sources":["../../../../../admin/src/components/AIChat/hooks/useAIFetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n\n/**\n * In charge of fetching data from Strapi AI endpoints\n */\n\nimport { useState } from 'react';\n\nimport { UIMessage, useChat } from '@ai-sdk/react';\nimport { useAppInfo } from '@strapi/admin/strapi-admin';\nimport { useGetAIUsageQuery } from '@strapi/admin/strapi-admin/ee';\nimport { DefaultChatTransport } from 'ai';\n\nimport { fetchAI, makeChatFetch, safeParseJson } from '../lib/aiClient';\nimport { STRAPI_AI_CHAT_URL, STRAPI_AI_URL } from '../lib/constants';\nimport { Attachment } from '../lib/types/attachments';\nimport { Schema } from '../lib/types/schema';\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n/**\n * Chat title\n */\nexport namespace GenerateTitle {\n export interface Request {\n body: {\n chatId: string;\n message: string;\n };\n }\n export interface Response {\n data: {\n title: string;\n };\n error?: string;\n }\n}\n\n/**\n * Upload a project to the chat\n */\nexport namespace UploadProject {\n export interface Request {\n body: {\n chatId: string;\n name: string;\n type: 'code';\n files: {\n path: string;\n content: string;\n }[];\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Send chat feedback\n */\nexport type FeedbackReasonIds =\n | 'invalid_schema'\n | 'bad_recommendation'\n | 'slow'\n | 'instructions_ignored'\n | 'being_lazy'\n | 'other';\n\nnamespace SendFeedback {\n export interface Request {\n body: {\n chatId: string;\n type: 'upvote' | 'downvote';\n feedback?: string;\n reasons?: FeedbackReasonIds[];\n messageId: string;\n messages: UIMessage[];\n schemas: Schema[];\n };\n }\n}\n\n/**\n * Upload media\n */\nexport namespace UploadMedia {\n export interface Request {\n body: {\n url: string; // base64 image\n filename: string;\n chatId: string;\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Collection of API endpoints and their corresponding request/response types\n */\ntype AIEndpoints = {\n '/schemas/chat/generate-title': {\n request: GenerateTitle.Request;\n response: GenerateTitle.Response;\n };\n '/schemas/chat/attachment': {\n request: UploadProject.Request;\n response: UploadProject.Response;\n };\n '/schemas/chat/feedback': {\n request: SendFeedback.Request;\n response: void;\n };\n '/media/upload': {\n request: UploadMedia.Request;\n response: UploadMedia.Response;\n };\n};\n\n// Helper type to extract the request type for a given endpoint\ntype RequestType<T extends keyof AIEndpoints> = AIEndpoints[T]['request'];\n\n// Helper type to extract the response type for a given endpoint\ntype ResponseType<T extends keyof AIEndpoints> = AIEndpoints[T]['response'];\n\n/* -------------------------------------------------------------------------------------------------\n * Hooks\n * -----------------------------------------------------------------------------------------------*/\n\nexport const TOO_MANY_REQUESTS_ERROR = 'Too many requests';\nexport const LICENSE_LIMIT_REACHED_ERROR = 'License limit';\nexport const LICENSE_LIMIT_EXCEEDED_ERROR = 'AI credit limit exceeded';\nexport const CHAT_TOO_LONG_ERROR = 'Chat too long';\nexport const ATTACHMENT_TOO_BIG_ERROR = 'Attachment too big';\nexport const ATTACHMENT_NOT_FOUND_ERROR = 'Attachment not found';\nexport const INVALID_REQUEST_ERROR = 'Invalid request';\n\n/**\n * Base hook factory for making type-safe API calls to Strapi AI endpoints.\n * Creates a hook specific to a single endpoint.\n */\nexport const createAIFetchHook = <T extends keyof AIEndpoints>(endpoint: T) => {\n return () => {\n const strapiVersion = useAppInfo('useAIFetch', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIFetch-user', (state) => state.userId);\n const aiUsage = useGetAIUsageQuery(undefined, { refetchOnMountOrArgChange: true });\n\n const [isPending, setIsPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Make a type-safe API call to the specified Strapi AI endpoint with retry logic\n */\n const fetchData = async (\n options: Omit<RequestInit, 'body'> & Partial<RequestType<T>> & { formData?: FormData } = {}\n ): Promise<ResponseType<T> | null> => {\n setIsPending(true);\n setError(null);\n\n try {\n const fullUrl = `${STRAPI_AI_URL}${endpoint}`;\n const isJson = !!options.body && !options.formData;\n\n const response = await fetchAI(fullUrl, {\n method: 'POST',\n headers: isJson\n ? { 'Content-Type': 'application/json', ...(options.headers || {}) }\n : options.headers,\n body: options.formData\n ? options.formData\n : isJson\n ? JSON.stringify(options.body || {})\n : undefined,\n ctx: { strapiVersion, projectId, userId },\n });\n // refetch ai usage data on every successful request\n aiUsage.refetch();\n\n const body = await safeParseJson(response);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.statusText}`);\n }\n return body as ResponseType<T>;\n } catch (err) {\n setError(err instanceof Error ? err.message : `Failed to fetch data from ${endpoint}`);\n return null;\n } finally {\n setIsPending(false);\n }\n };\n\n return {\n isPending,\n error,\n fetch: fetchData,\n };\n };\n};\n\n// Create specific hooks for each endpoint\nexport const useFetchGenerateTitle = createAIFetchHook('/schemas/chat/generate-title');\nexport const useFetchUploadProject = createAIFetchHook('/schemas/chat/attachment');\nexport const useFetchSendFeedback = createAIFetchHook('/schemas/chat/feedback');\nexport const useFetchUploadMedia = createAIFetchHook('/media/upload');\n\n/**\n * Hook wrapper for AI SDK's useChat with Strapi-specific configuration\n */\nexport const useAIChat: typeof useChat = (props) => {\n const strapiVersion = useAppInfo('useAIChat', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIChat-user', (state) => state.userId);\n\n const customFetch = makeChatFetch({ strapiVersion, projectId, userId });\n\n return useChat({\n ...props,\n transport: new DefaultChatTransport({\n api: STRAPI_AI_CHAT_URL,\n fetch: customFetch,\n }),\n });\n};\n"],"names":["TOO_MANY_REQUESTS_ERROR","LICENSE_LIMIT_REACHED_ERROR","LICENSE_LIMIT_EXCEEDED_ERROR","CHAT_TOO_LONG_ERROR","createAIFetchHook","endpoint","strapiVersion","useAppInfo","state","projectId","userId","aiUsage","useGetAIUsageQuery","undefined","refetchOnMountOrArgChange","isPending","setIsPending","useState","error","setError","fetchData","options","fullUrl","STRAPI_AI_URL","isJson","body","formData","response","fetchAI","method","headers","JSON","stringify","ctx","refetch","safeParseJson","ok","Error","statusText","err","message","fetch","useFetchGenerateTitle","useFetchUploadProject","useFetchSendFeedback","useFetchUploadMedia","useAIChat","props","customFetch","makeChatFetch","useChat","transport","DefaultChatTransport","api","STRAPI_AI_CHAT_URL"],"mappings":";;;;;;;;;;AAkIA;;qGAIO,MAAMA,uBAAAA,GAA0B;AAChC,MAAMC,8BAA8B;AACpC,MAAMC,+BAA+B;AACrC,MAAMC,sBAAsB;AAKnC;;;IAIO,MAAMC,iBAAAA,GAAoB,CAA8BC,QAAAA,GAAAA;IAC7D,OAAO,IAAA;AACL,QAAA,MAAMC,gBAAgBC,sBAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMF,aAAa,CAAA;AAC7E,QAAA,MAAMG,YAAYF,sBAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,QAAA,MAAMC,SAASH,sBAAAA,CAAW,iBAAA,EAAmB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;QACpE,MAAMC,OAAAA,GAAUC,sBAAmBC,SAAAA,EAAW;YAAEC,yBAAAA,EAA2B;AAAK,SAAA,CAAA;AAEhF,QAAA,MAAM,CAACC,SAAAA,EAAWC,YAAAA,CAAa,GAAGC,cAAAA,CAAS,KAAA,CAAA;AAC3C,QAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGF,cAAAA,CAAwB,IAAA,CAAA;AAElD;;AAEC,QACD,MAAMG,SAAAA,GAAY,OAChBC,OAAAA,GAAyF,EAAE,GAAA;YAE3FL,YAAAA,CAAa,IAAA,CAAA;YACbG,QAAAA,CAAS,IAAA,CAAA;YAET,IAAI;gBACF,MAAMG,OAAAA,GAAU,CAAA,EAAGC,uBAAAA,CAAAA,EAAgBlB,QAAAA,CAAAA,CAAU;gBAC7C,MAAMmB,MAAAA,GAAS,CAAC,CAACH,OAAAA,CAAQI,IAAI,IAAI,CAACJ,QAAQK,QAAQ;gBAElD,MAAMC,QAAA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D,MAAMuC,qBAAAA,GAAwBvC,iBAAAA,CAAkB,0BAAA;AAChD,MAAMwC,oBAAAA,GAAuBxC,iBAAAA,CAAkB,wBAAA;AAC/C,MAAMyC,mBAAAA,GAAsBzC,iBAAAA,CAAkB,eAAA;AAErD;;IAGO,MAAM0C,SAAAA,GAA4B,CAACC,KAAAA,GAAAA;AACxC,IAAA,MAAMzC,gBAAgBC,sBAAAA,CAAW,WAAA,EAAa,CAACC,KAAAA,GAAUA,MAAMF,aAAa,CAAA;AAC5E,IAAA,MAAMG,YAAYF,sBAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,IAAA,MAAMC,SAASH,sBAAAA,CAAW,gBAAA,EAAkB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;AAEnE,IAAA,MAAMsC,cAAcC,sBAAAA,CAAc;AAAE3C,QAAAA,aAAAA;AAAeG,QAAAA,SAAAA;AAAWC,QAAAA;AAAO,KAAA,CAAA;AAErE,IAAA,OAAOwC,aAAAA,CAAQ;AACb,QAAA,GAAGH,KAAK;AACRI,QAAAA,SAAAA,EAAW,IAAIC,uBAAAA,CAAqB;YAClCC,GAAAA,EAAKC,4BAAAA;YACLb,KAAAA,EAAOO;AACT,SAAA;AACF,KAAA,CAAA;AACF;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"useAIFetch.js","sources":["../../../../../admin/src/components/AIChat/hooks/useAIFetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n\n/**\n * In charge of fetching data from Strapi AI endpoints\n */\n\nimport { useState } from 'react';\n\nimport { UIMessage, useChat } from '@ai-sdk/react';\nimport { useAppInfo } from '@strapi/admin/strapi-admin';\nimport { useGetAiUsageQuery } from '@strapi/admin/strapi-admin/ee';\nimport { DefaultChatTransport } from 'ai';\n\nimport { fetchAI, makeChatFetch, safeParseJson } from '../lib/aiClient';\nimport { STRAPI_AI_CHAT_URL, STRAPI_AI_URL } from '../lib/constants';\nimport { Attachment } from '../lib/types/attachments';\nimport { Schema } from '../lib/types/schema';\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n/**\n * Chat title\n */\nexport namespace GenerateTitle {\n export interface Request {\n body: {\n chatId: string;\n message: string;\n };\n }\n export interface Response {\n data: {\n title: string;\n };\n error?: string;\n }\n}\n\n/**\n * Upload a project to the chat\n */\nexport namespace UploadProject {\n export interface Request {\n body: {\n chatId: string;\n name: string;\n type: 'code';\n files: {\n path: string;\n content: string;\n }[];\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Send chat feedback\n */\nexport type FeedbackReasonIds =\n | 'invalid_schema'\n | 'bad_recommendation'\n | 'slow'\n | 'instructions_ignored'\n | 'being_lazy'\n | 'other';\n\nnamespace SendFeedback {\n export interface Request {\n body: {\n chatId: string;\n type: 'upvote' | 'downvote';\n feedback?: string;\n reasons?: FeedbackReasonIds[];\n messageId: string;\n messages: UIMessage[];\n schemas: Schema[];\n };\n }\n}\n\n/**\n * Upload media\n */\nexport namespace UploadMedia {\n export interface Request {\n body: {\n url: string; // base64 image\n filename: string;\n chatId: string;\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Collection of API endpoints and their corresponding request/response types\n */\ntype AIEndpoints = {\n '/schemas/chat/generate-title': {\n request: GenerateTitle.Request;\n response: GenerateTitle.Response;\n };\n '/schemas/chat/attachment': {\n request: UploadProject.Request;\n response: UploadProject.Response;\n };\n '/schemas/chat/feedback': {\n request: SendFeedback.Request;\n response: void;\n };\n '/media/upload': {\n request: UploadMedia.Request;\n response: UploadMedia.Response;\n };\n};\n\n// Helper type to extract the request type for a given endpoint\ntype RequestType<T extends keyof AIEndpoints> = AIEndpoints[T]['request'];\n\n// Helper type to extract the response type for a given endpoint\ntype ResponseType<T extends keyof AIEndpoints> = AIEndpoints[T]['response'];\n\n/* -------------------------------------------------------------------------------------------------\n * Hooks\n * -----------------------------------------------------------------------------------------------*/\n\nexport const TOO_MANY_REQUESTS_ERROR = 'Too many requests';\nexport const LICENSE_LIMIT_REACHED_ERROR = 'License limit';\nexport const LICENSE_LIMIT_EXCEEDED_ERROR = 'AI credit limit exceeded';\nexport const CHAT_TOO_LONG_ERROR = 'Chat too long';\nexport const ATTACHMENT_TOO_BIG_ERROR = 'Attachment too big';\nexport const ATTACHMENT_NOT_FOUND_ERROR = 'Attachment not found';\nexport const INVALID_REQUEST_ERROR = 'Invalid request';\n\n/**\n * Base hook factory for making type-safe API calls to Strapi AI endpoints.\n * Creates a hook specific to a single endpoint.\n */\nexport const createAIFetchHook = <T extends keyof AIEndpoints>(endpoint: T) => {\n return () => {\n const strapiVersion = useAppInfo('useAIFetch', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIFetch-user', (state) => state.userId);\n const aiUsage = useGetAiUsageQuery(undefined, { refetchOnMountOrArgChange: true });\n\n const [isPending, setIsPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Make a type-safe API call to the specified Strapi AI endpoint with retry logic\n */\n const fetchData = async (\n options: Omit<RequestInit, 'body'> & Partial<RequestType<T>> & { formData?: FormData } = {}\n ): Promise<ResponseType<T> | null> => {\n setIsPending(true);\n setError(null);\n\n try {\n const fullUrl = `${STRAPI_AI_URL}${endpoint}`;\n const isJson = !!options.body && !options.formData;\n\n const response = await fetchAI(fullUrl, {\n method: 'POST',\n headers: isJson\n ? { 'Content-Type': 'application/json', ...(options.headers || {}) }\n : options.headers,\n body: options.formData\n ? options.formData\n : isJson\n ? JSON.stringify(options.body || {})\n : undefined,\n ctx: { strapiVersion, projectId, userId },\n });\n // refetch ai usage data on every successful request\n aiUsage.refetch();\n\n const body = await safeParseJson(response);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.statusText}`);\n }\n return body as ResponseType<T>;\n } catch (err) {\n setError(err instanceof Error ? err.message : `Failed to fetch data from ${endpoint}`);\n return null;\n } finally {\n setIsPending(false);\n }\n };\n\n return {\n isPending,\n error,\n fetch: fetchData,\n };\n };\n};\n\n// Create specific hooks for each endpoint\nexport const useFetchGenerateTitle = createAIFetchHook('/schemas/chat/generate-title');\nexport const useFetchUploadProject = createAIFetchHook('/schemas/chat/attachment');\nexport const useFetchSendFeedback = createAIFetchHook('/schemas/chat/feedback');\nexport const useFetchUploadMedia = createAIFetchHook('/media/upload');\n\n/**\n * Hook wrapper for AI SDK's useChat with Strapi-specific configuration\n */\nexport const useAIChat: typeof useChat = (props) => {\n const strapiVersion = useAppInfo('useAIChat', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIChat-user', (state) => state.userId);\n\n const customFetch = makeChatFetch({ strapiVersion, projectId, userId });\n\n return useChat({\n ...props,\n transport: new DefaultChatTransport({\n api: STRAPI_AI_CHAT_URL,\n fetch: customFetch,\n }),\n });\n};\n"],"names":["TOO_MANY_REQUESTS_ERROR","LICENSE_LIMIT_REACHED_ERROR","LICENSE_LIMIT_EXCEEDED_ERROR","CHAT_TOO_LONG_ERROR","createAIFetchHook","endpoint","strapiVersion","useAppInfo","state","projectId","userId","aiUsage","useGetAiUsageQuery","undefined","refetchOnMountOrArgChange","isPending","setIsPending","useState","error","setError","fetchData","options","fullUrl","STRAPI_AI_URL","isJson","body","formData","response","fetchAI","method","headers","JSON","stringify","ctx","refetch","safeParseJson","ok","Error","statusText","err","message","fetch","useFetchGenerateTitle","useFetchUploadProject","useFetchSendFeedback","useFetchUploadMedia","useAIChat","props","customFetch","makeChatFetch","useChat","transport","DefaultChatTransport","api","STRAPI_AI_CHAT_URL"],"mappings":";;;;;;;;;;AAkIA;;qGAIO,MAAMA,uBAAAA,GAA0B;AAChC,MAAMC,8BAA8B;AACpC,MAAMC,+BAA+B;AACrC,MAAMC,sBAAsB;AAKnC;;;IAIO,MAAMC,iBAAAA,GAAoB,CAA8BC,QAAAA,GAAAA;IA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MAAMG,YAAYF,sBAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,IAAA,MAAMC,SAASH,sBAAAA,CAAW,gBAAA,EAAkB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;AAEnE,IAAA,MAAMsC,cAAcC,sBAAAA,CAAc;AAAE3C,QAAAA,aAAAA;AAAeG,QAAAA,SAAAA;AAAWC,QAAAA;AAAO,KAAA,CAAA;AAErE,IAAA,OAAOwC,aAAAA,CAAQ;AACb,QAAA,GAAGH,KAAK;AACRI,QAAAA,SAAAA,EAAW,IAAIC,uBAAAA,CAAqB;YAClCC,GAAAA,EAAKC,4BAAAA;YACLb,KAAAA,EAAOO;AACT,SAAA;AACF,KAAA,CAAA;AACF;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useChat } from '@ai-sdk/react';
|
|
3
3
|
import { useAppInfo } from '@strapi/admin/strapi-admin';
|
|
4
|
-
import {
|
|
4
|
+
import { useGetAiUsageQuery } from '@strapi/admin/strapi-admin/ee';
|
|
5
5
|
import { DefaultChatTransport } from 'ai';
|
|
6
6
|
import { makeChatFetch, fetchAI, safeParseJson } from '../lib/aiClient.mjs';
|
|
7
7
|
import { STRAPI_AI_CHAT_URL, STRAPI_AI_URL } from '../lib/constants.mjs';
|
|
@@ -20,7 +20,7 @@ const CHAT_TOO_LONG_ERROR = 'Chat too long';
|
|
|
20
20
|
const strapiVersion = useAppInfo('useAIFetch', (state)=>state.strapiVersion);
|
|
21
21
|
const projectId = useAppInfo('useAIFetch', (state)=>state.projectId);
|
|
22
22
|
const userId = useAppInfo('useAIFetch-user', (state)=>state.userId);
|
|
23
|
-
const aiUsage =
|
|
23
|
+
const aiUsage = useGetAiUsageQuery(undefined, {
|
|
24
24
|
refetchOnMountOrArgChange: true
|
|
25
25
|
});
|
|
26
26
|
const [isPending, setIsPending] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAIFetch.mjs","sources":["../../../../../admin/src/components/AIChat/hooks/useAIFetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n\n/**\n * In charge of fetching data from Strapi AI endpoints\n */\n\nimport { useState } from 'react';\n\nimport { UIMessage, useChat } from '@ai-sdk/react';\nimport { useAppInfo } from '@strapi/admin/strapi-admin';\nimport { useGetAIUsageQuery } from '@strapi/admin/strapi-admin/ee';\nimport { DefaultChatTransport } from 'ai';\n\nimport { fetchAI, makeChatFetch, safeParseJson } from '../lib/aiClient';\nimport { STRAPI_AI_CHAT_URL, STRAPI_AI_URL } from '../lib/constants';\nimport { Attachment } from '../lib/types/attachments';\nimport { Schema } from '../lib/types/schema';\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n/**\n * Chat title\n */\nexport namespace GenerateTitle {\n export interface Request {\n body: {\n chatId: string;\n message: string;\n };\n }\n export interface Response {\n data: {\n title: string;\n };\n error?: string;\n }\n}\n\n/**\n * Upload a project to the chat\n */\nexport namespace UploadProject {\n export interface Request {\n body: {\n chatId: string;\n name: string;\n type: 'code';\n files: {\n path: string;\n content: string;\n }[];\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Send chat feedback\n */\nexport type FeedbackReasonIds =\n | 'invalid_schema'\n | 'bad_recommendation'\n | 'slow'\n | 'instructions_ignored'\n | 'being_lazy'\n | 'other';\n\nnamespace SendFeedback {\n export interface Request {\n body: {\n chatId: string;\n type: 'upvote' | 'downvote';\n feedback?: string;\n reasons?: FeedbackReasonIds[];\n messageId: string;\n messages: UIMessage[];\n schemas: Schema[];\n };\n }\n}\n\n/**\n * Upload media\n */\nexport namespace UploadMedia {\n export interface Request {\n body: {\n url: string; // base64 image\n filename: string;\n chatId: string;\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Collection of API endpoints and their corresponding request/response types\n */\ntype AIEndpoints = {\n '/schemas/chat/generate-title': {\n request: GenerateTitle.Request;\n response: GenerateTitle.Response;\n };\n '/schemas/chat/attachment': {\n request: UploadProject.Request;\n response: UploadProject.Response;\n };\n '/schemas/chat/feedback': {\n request: SendFeedback.Request;\n response: void;\n };\n '/media/upload': {\n request: UploadMedia.Request;\n response: UploadMedia.Response;\n };\n};\n\n// Helper type to extract the request type for a given endpoint\ntype RequestType<T extends keyof AIEndpoints> = AIEndpoints[T]['request'];\n\n// Helper type to extract the response type for a given endpoint\ntype ResponseType<T extends keyof AIEndpoints> = AIEndpoints[T]['response'];\n\n/* -------------------------------------------------------------------------------------------------\n * Hooks\n * -----------------------------------------------------------------------------------------------*/\n\nexport const TOO_MANY_REQUESTS_ERROR = 'Too many requests';\nexport const LICENSE_LIMIT_REACHED_ERROR = 'License limit';\nexport const LICENSE_LIMIT_EXCEEDED_ERROR = 'AI credit limit exceeded';\nexport const CHAT_TOO_LONG_ERROR = 'Chat too long';\nexport const ATTACHMENT_TOO_BIG_ERROR = 'Attachment too big';\nexport const ATTACHMENT_NOT_FOUND_ERROR = 'Attachment not found';\nexport const INVALID_REQUEST_ERROR = 'Invalid request';\n\n/**\n * Base hook factory for making type-safe API calls to Strapi AI endpoints.\n * Creates a hook specific to a single endpoint.\n */\nexport const createAIFetchHook = <T extends keyof AIEndpoints>(endpoint: T) => {\n return () => {\n const strapiVersion = useAppInfo('useAIFetch', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIFetch-user', (state) => state.userId);\n const aiUsage = useGetAIUsageQuery(undefined, { refetchOnMountOrArgChange: true });\n\n const [isPending, setIsPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Make a type-safe API call to the specified Strapi AI endpoint with retry logic\n */\n const fetchData = async (\n options: Omit<RequestInit, 'body'> & Partial<RequestType<T>> & { formData?: FormData } = {}\n ): Promise<ResponseType<T> | null> => {\n setIsPending(true);\n setError(null);\n\n try {\n const fullUrl = `${STRAPI_AI_URL}${endpoint}`;\n const isJson = !!options.body && !options.formData;\n\n const response = await fetchAI(fullUrl, {\n method: 'POST',\n headers: isJson\n ? { 'Content-Type': 'application/json', ...(options.headers || {}) }\n : options.headers,\n body: options.formData\n ? options.formData\n : isJson\n ? JSON.stringify(options.body || {})\n : undefined,\n ctx: { strapiVersion, projectId, userId },\n });\n // refetch ai usage data on every successful request\n aiUsage.refetch();\n\n const body = await safeParseJson(response);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.statusText}`);\n }\n return body as ResponseType<T>;\n } catch (err) {\n setError(err instanceof Error ? err.message : `Failed to fetch data from ${endpoint}`);\n return null;\n } finally {\n setIsPending(false);\n }\n };\n\n return {\n isPending,\n error,\n fetch: fetchData,\n };\n };\n};\n\n// Create specific hooks for each endpoint\nexport const useFetchGenerateTitle = createAIFetchHook('/schemas/chat/generate-title');\nexport const useFetchUploadProject = createAIFetchHook('/schemas/chat/attachment');\nexport const useFetchSendFeedback = createAIFetchHook('/schemas/chat/feedback');\nexport const useFetchUploadMedia = createAIFetchHook('/media/upload');\n\n/**\n * Hook wrapper for AI SDK's useChat with Strapi-specific configuration\n */\nexport const useAIChat: typeof useChat = (props) => {\n const strapiVersion = useAppInfo('useAIChat', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIChat-user', (state) => state.userId);\n\n const customFetch = makeChatFetch({ strapiVersion, projectId, userId });\n\n return useChat({\n ...props,\n transport: new DefaultChatTransport({\n api: STRAPI_AI_CHAT_URL,\n fetch: customFetch,\n }),\n });\n};\n"],"names":["TOO_MANY_REQUESTS_ERROR","LICENSE_LIMIT_REACHED_ERROR","LICENSE_LIMIT_EXCEEDED_ERROR","CHAT_TOO_LONG_ERROR","createAIFetchHook","endpoint","strapiVersion","useAppInfo","state","projectId","userId","aiUsage","useGetAIUsageQuery","undefined","refetchOnMountOrArgChange","isPending","setIsPending","useState","error","setError","fetchData","options","fullUrl","STRAPI_AI_URL","isJson","body","formData","response","fetchAI","method","headers","JSON","stringify","ctx","refetch","safeParseJson","ok","Error","statusText","err","message","fetch","useFetchGenerateTitle","useFetchUploadProject","useFetchSendFeedback","useFetchUploadMedia","useAIChat","props","customFetch","makeChatFetch","useChat","transport","DefaultChatTransport","api","STRAPI_AI_CHAT_URL"],"mappings":";;;;;;;;AAkIA;;qGAIO,MAAMA,uBAAAA,GAA0B;AAChC,MAAMC,8BAA8B;AACpC,MAAMC,+BAA+B;AACrC,MAAMC,sBAAsB;AAKnC;;;IAIO,MAAMC,iBAAAA,GAAoB,CAA8BC,QAAAA,GAAAA;IAC7D,OAAO,IAAA;AACL,QAAA,MAAMC,gBAAgBC,UAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMF,aAAa,CAAA;AAC7E,QAAA,MAAMG,YAAYF,UAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,QAAA,MAAMC,SAASH,UAAAA,CAAW,iBAAA,EAAmB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;QACpE,MAAMC,OAAAA,GAAUC,mBAAmBC,SAAAA,EAAW;YAAEC,yBAAAA,EAA2B;AAAK,SAAA,CAAA;AAEhF,QAAA,MAAM,CAACC,SAAAA,EAAWC,YAAAA,CAAa,GAAGC,QAAAA,CAAS,KAAA,CAAA;AAC3C,QAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGF,QAAAA,CAAwB,IAAA,CAAA;AAElD;;AAEC,QACD,MAAMG,SAAAA,GAAY,OAChBC,OAAAA,GAAyF,EAAE,GAAA;YAE3FL,YAAAA,CAAa,IAAA,CAAA;YACbG,QAAAA,CAAS,IAAA,CAAA;YAET,IAAI;gBACF,MAAMG,OAAAA,GAAU,CAAA,EAAGC,aAAAA,CAAAA,EAAgBlB,QAAAA,CAAAA,CAAU;gBAC7C,MAAMmB,MAAAA,GAAS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AA,CAAA;AACF;AAEA;AACO,MAAMsB,qBAAAA,GAAwBtC,iBAAAA,CAAkB,8BAAA;AAChD,MAAMuC,qBAAAA,GAAwBvC,iBAAAA,CAAkB,0BAAA;AAChD,MAAMwC,oBAAAA,GAAuBxC,iBAAAA,CAAkB,wBAAA;AAC/C,MAAMyC,mBAAAA,GAAsBzC,iBAAAA,CAAkB,eAAA;AAErD;;IAGO,MAAM0C,SAAAA,GAA4B,CAACC,KAAAA,GAAAA;AACxC,IAAA,MAAMzC,gBAAgBC,UAAAA,CAAW,WAAA,EAAa,CAACC,KAAAA,GAAUA,MAAMF,aAAa,CAAA;AAC5E,IAAA,MAAMG,YAAYF,UAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,IAAA,MAAMC,SAASH,UAAAA,CAAW,gBAAA,EAAkB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;AAEnE,IAAA,MAAMsC,cAAcC,aAAAA,CAAc;AAAE3C,QAAAA,aAAAA;AAAeG,QAAAA,SAAAA;AAAWC,QAAAA;AAAO,KAAA,CAAA;AAErE,IAAA,OAAOwC,OAAAA,CAAQ;AACb,QAAA,GAAGH,KAAK;AACRI,QAAAA,SAAAA,EAAW,IAAIC,oBAAAA,CAAqB;YAClCC,GAAAA,EAAKC,kBAAAA;YACLb,KAAAA,EAAOO;AACT,SAAA;AACF,KAAA,CAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"useAIFetch.mjs","sources":["../../../../../admin/src/components/AIChat/hooks/useAIFetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\n\n/**\n * In charge of fetching data from Strapi AI endpoints\n */\n\nimport { useState } from 'react';\n\nimport { UIMessage, useChat } from '@ai-sdk/react';\nimport { useAppInfo } from '@strapi/admin/strapi-admin';\nimport { useGetAiUsageQuery } from '@strapi/admin/strapi-admin/ee';\nimport { DefaultChatTransport } from 'ai';\n\nimport { fetchAI, makeChatFetch, safeParseJson } from '../lib/aiClient';\nimport { STRAPI_AI_CHAT_URL, STRAPI_AI_URL } from '../lib/constants';\nimport { Attachment } from '../lib/types/attachments';\nimport { Schema } from '../lib/types/schema';\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n/**\n * Chat title\n */\nexport namespace GenerateTitle {\n export interface Request {\n body: {\n chatId: string;\n message: string;\n };\n }\n export interface Response {\n data: {\n title: string;\n };\n error?: string;\n }\n}\n\n/**\n * Upload a project to the chat\n */\nexport namespace UploadProject {\n export interface Request {\n body: {\n chatId: string;\n name: string;\n type: 'code';\n files: {\n path: string;\n content: string;\n }[];\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Send chat feedback\n */\nexport type FeedbackReasonIds =\n | 'invalid_schema'\n | 'bad_recommendation'\n | 'slow'\n | 'instructions_ignored'\n | 'being_lazy'\n | 'other';\n\nnamespace SendFeedback {\n export interface Request {\n body: {\n chatId: string;\n type: 'upvote' | 'downvote';\n feedback?: string;\n reasons?: FeedbackReasonIds[];\n messageId: string;\n messages: UIMessage[];\n schemas: Schema[];\n };\n }\n}\n\n/**\n * Upload media\n */\nexport namespace UploadMedia {\n export interface Request {\n body: {\n url: string; // base64 image\n filename: string;\n chatId: string;\n };\n }\n export interface Response {\n data: Attachment;\n error?: string;\n }\n}\n\n/**\n * Collection of API endpoints and their corresponding request/response types\n */\ntype AIEndpoints = {\n '/schemas/chat/generate-title': {\n request: GenerateTitle.Request;\n response: GenerateTitle.Response;\n };\n '/schemas/chat/attachment': {\n request: UploadProject.Request;\n response: UploadProject.Response;\n };\n '/schemas/chat/feedback': {\n request: SendFeedback.Request;\n response: void;\n };\n '/media/upload': {\n request: UploadMedia.Request;\n response: UploadMedia.Response;\n };\n};\n\n// Helper type to extract the request type for a given endpoint\ntype RequestType<T extends keyof AIEndpoints> = AIEndpoints[T]['request'];\n\n// Helper type to extract the response type for a given endpoint\ntype ResponseType<T extends keyof AIEndpoints> = AIEndpoints[T]['response'];\n\n/* -------------------------------------------------------------------------------------------------\n * Hooks\n * -----------------------------------------------------------------------------------------------*/\n\nexport const TOO_MANY_REQUESTS_ERROR = 'Too many requests';\nexport const LICENSE_LIMIT_REACHED_ERROR = 'License limit';\nexport const LICENSE_LIMIT_EXCEEDED_ERROR = 'AI credit limit exceeded';\nexport const CHAT_TOO_LONG_ERROR = 'Chat too long';\nexport const ATTACHMENT_TOO_BIG_ERROR = 'Attachment too big';\nexport const ATTACHMENT_NOT_FOUND_ERROR = 'Attachment not found';\nexport const INVALID_REQUEST_ERROR = 'Invalid request';\n\n/**\n * Base hook factory for making type-safe API calls to Strapi AI endpoints.\n * Creates a hook specific to a single endpoint.\n */\nexport const createAIFetchHook = <T extends keyof AIEndpoints>(endpoint: T) => {\n return () => {\n const strapiVersion = useAppInfo('useAIFetch', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIFetch-user', (state) => state.userId);\n const aiUsage = useGetAiUsageQuery(undefined, { refetchOnMountOrArgChange: true });\n\n const [isPending, setIsPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * Make a type-safe API call to the specified Strapi AI endpoint with retry logic\n */\n const fetchData = async (\n options: Omit<RequestInit, 'body'> & Partial<RequestType<T>> & { formData?: FormData } = {}\n ): Promise<ResponseType<T> | null> => {\n setIsPending(true);\n setError(null);\n\n try {\n const fullUrl = `${STRAPI_AI_URL}${endpoint}`;\n const isJson = !!options.body && !options.formData;\n\n const response = await fetchAI(fullUrl, {\n method: 'POST',\n headers: isJson\n ? { 'Content-Type': 'application/json', ...(options.headers || {}) }\n : options.headers,\n body: options.formData\n ? options.formData\n : isJson\n ? JSON.stringify(options.body || {})\n : undefined,\n ctx: { strapiVersion, projectId, userId },\n });\n // refetch ai usage data on every successful request\n aiUsage.refetch();\n\n const body = await safeParseJson(response);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.statusText}`);\n }\n return body as ResponseType<T>;\n } catch (err) {\n setError(err instanceof Error ? err.message : `Failed to fetch data from ${endpoint}`);\n return null;\n } finally {\n setIsPending(false);\n }\n };\n\n return {\n isPending,\n error,\n fetch: fetchData,\n };\n };\n};\n\n// Create specific hooks for each endpoint\nexport const useFetchGenerateTitle = createAIFetchHook('/schemas/chat/generate-title');\nexport const useFetchUploadProject = createAIFetchHook('/schemas/chat/attachment');\nexport const useFetchSendFeedback = createAIFetchHook('/schemas/chat/feedback');\nexport const useFetchUploadMedia = createAIFetchHook('/media/upload');\n\n/**\n * Hook wrapper for AI SDK's useChat with Strapi-specific configuration\n */\nexport const useAIChat: typeof useChat = (props) => {\n const strapiVersion = useAppInfo('useAIChat', (state) => state.strapiVersion);\n const projectId = useAppInfo('useAIFetch', (state) => state.projectId);\n const userId = useAppInfo('useAIChat-user', (state) => state.userId);\n\n const customFetch = makeChatFetch({ strapiVersion, projectId, userId });\n\n return useChat({\n ...props,\n transport: new DefaultChatTransport({\n api: STRAPI_AI_CHAT_URL,\n fetch: customFetch,\n }),\n });\n};\n"],"names":["TOO_MANY_REQUESTS_ERROR","LICENSE_LIMIT_REACHED_ERROR","LICENSE_LIMIT_EXCEEDED_ERROR","CHAT_TOO_LONG_ERROR","createAIFetchHook","endpoint","strapiVersion","useAppInfo","state","projectId","userId","aiUsage","useGetAiUsageQuery","undefined","refetchOnMountOrArgChange","isPending","setIsPending","useState","error","setError","fetchData","options","fullUrl","STRAPI_AI_URL","isJson","body","formData","response","fetchAI","method","headers","JSON","stringify","ctx","refetch","safeParseJson","ok","Error","statusText","err","message","fetch","useFetchGenerateTitle","useFetchUploadProject","useFetchSendFeedback","useFetchUploadMedia","useAIChat","props","customFetch","makeChatFetch","useChat","transport","DefaultChatTransport","api","STRAPI_AI_CHAT_URL"],"mappings":";;;;;;;;AAkIA;;qGAIO,MAAMA,uBAAAA,GAA0B;AAChC,MAAMC,8BAA8B;AACpC,MAAMC,+BAA+B;AACrC,MAAMC,sBAAsB;A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,CAACC,KAAAA,GAAUA,MAAMF,aAAa,CAAA;AAC5E,IAAA,MAAMG,YAAYF,UAAAA,CAAW,YAAA,EAAc,CAACC,KAAAA,GAAUA,MAAMC,SAAS,CAAA;AACrE,IAAA,MAAMC,SAASH,UAAAA,CAAW,gBAAA,EAAkB,CAACC,KAAAA,GAAUA,MAAME,MAAM,CAAA;AAEnE,IAAA,MAAMsC,cAAcC,aAAAA,CAAc;AAAE3C,QAAAA,aAAAA;AAAeG,QAAAA,SAAAA;AAAWC,QAAAA;AAAO,KAAA,CAAA;AAErE,IAAA,OAAOwC,OAAAA,CAAQ;AACb,QAAA,GAAGH,KAAK;AACRI,QAAAA,SAAAA,EAAW,IAAIC,oBAAAA,CAAqB;YAClCC,GAAAA,EAAKC,kBAAAA;YACLb,KAAAA,EAAOO;AACT,SAAA;AACF,KAAA,CAAA;AACF;;;;"}
|
|
@@ -6,9 +6,10 @@ var configurations = "nastavení";
|
|
|
6
6
|
var from = "od";
|
|
7
7
|
var cs = {
|
|
8
8
|
"attribute.boolean": "Boolean",
|
|
9
|
-
"attribute.boolean.description": "
|
|
9
|
+
"attribute.boolean.description": "Ano/ne, 1/0, true/false",
|
|
10
10
|
"attribute.component": "Komponent",
|
|
11
11
|
"attribute.component.description": "Skupina polí, které je možné opakovaně používat",
|
|
12
|
+
"attribute.customField": "Vlastní pole",
|
|
12
13
|
"attribute.date": "Datum a čas",
|
|
13
14
|
"attribute.date.description": "Dialog pro výběr datumu a času",
|
|
14
15
|
"attribute.datetime": "Datum a čas",
|
|
@@ -31,25 +32,49 @@ var cs = {
|
|
|
31
32
|
"attribute.relation.description": "Určuje vztah k jinému Typu obsahu",
|
|
32
33
|
"attribute.richtext": "Textový editor",
|
|
33
34
|
"attribute.richtext.description": "Textové pole s možnostmi formátování",
|
|
35
|
+
"attribute.blocks": "Rich text (Blocks)",
|
|
36
|
+
"attribute.blocks.description": "Nový editor rich textu založený na JSON",
|
|
34
37
|
"attribute.text": "Text",
|
|
35
38
|
"attribute.text.description": "Krátký nebo delší text",
|
|
36
39
|
"attribute.time": "Čas",
|
|
40
|
+
"attribute.timestamp": "Časové razítko",
|
|
37
41
|
"attribute.uid": "UID",
|
|
38
42
|
"attribute.uid.description": "Unikátní identifikátor",
|
|
39
43
|
"button.attributes.add.another": "Přidat další pole",
|
|
40
44
|
"button.component.add": "Přidat komponent",
|
|
41
45
|
"button.component.create": "Vytvorit nový komponent",
|
|
42
46
|
"button.model.create": "Vytvořit nový Typ obsahu",
|
|
47
|
+
"button.single-types.create": "Vytvořit nový single type",
|
|
48
|
+
"media.multiple": "Více",
|
|
43
49
|
"component.repeatable": "(opakující)",
|
|
50
|
+
"components.SelectComponents.displayed-value": "{number, plural, =0 {# komponent} one {# komponent} other {# komponent}} vybráno",
|
|
44
51
|
"components.componentSelect.no-component-available": "Už jste přidali všechny komponenty",
|
|
45
52
|
"components.componentSelect.no-component-available.with-search": "Nenašel se žádný komponent splňující výraz",
|
|
46
53
|
"components.componentSelect.value-component": "Označené komponenty: {number} (zadejte hledaný text)",
|
|
47
54
|
"components.componentSelect.value-components": "Označené komponenty: {number}",
|
|
48
55
|
configurations: configurations,
|
|
56
|
+
"contentType.apiId-plural.description": "Množné API ID",
|
|
57
|
+
"contentType.apiId-plural.label": "API ID (množné číslo)",
|
|
58
|
+
"contentType.apiId-singular.description": "UID se používá ke generování API cest a databázových tabulek/kolekcí",
|
|
59
|
+
"contentType.apiId-singular.label": "API ID (jednotné číslo)",
|
|
60
|
+
"contentType.collectionName.description": "Užitečné, když se název vašeho Typu obsahu liší od názvu tabulky",
|
|
49
61
|
"contentType.collectionName.label": "Interní název",
|
|
50
62
|
"contentType.displayName.label": "Název",
|
|
63
|
+
"contentType.kind.change.warning": "Právě jste změnili druh typu obsahu: API bude resetováno (cesty, controllery a služby budou přepsány).",
|
|
64
|
+
"error.attributeName.reserved-name": "Tento název nelze použít ve vašem typu obsahu, protože by mohl narušit jiné funkce",
|
|
65
|
+
"error.contentType.pluralName-used": "Tato hodnota nemůže být stejná jako jednotné číslo",
|
|
66
|
+
"error.contentType.singularName-used": "Tato hodnota nemůže být stejná jako množné číslo",
|
|
67
|
+
"error.contentType.singularName-equals-pluralName": "Tato hodnota nemůže být stejná jako množné API ID jiného typu obsahu.",
|
|
68
|
+
"error.contentType.pluralName-equals-singularName": "Tato hodnota nemůže být stejná jako jednotné API ID jiného typu obsahu.",
|
|
69
|
+
"error.contentType.pluralName-equals-collectionName": "Tato hodnota už je používána jiným typem obsahu.",
|
|
51
70
|
"error.contentTypeName.reserved-name": "Tento název je vyhrazený a nemůže být použit",
|
|
71
|
+
"error.validation.enum-duplicate": "Duplicitní hodnoty nejsou povoleny (berou se v úvahu pouze alfanumerické znaky).",
|
|
72
|
+
"error.validation.enum-empty-string": "Prázdné řetězce nejsou povoleny",
|
|
73
|
+
"error.validation.enum-regex": "Alespoň jedna hodnota není platná. Hodnoty by měly mít alespoň jeden abecední znak před prvním výskytem čísla.",
|
|
52
74
|
"error.validation.minSupMax": "Nemůže být nadřazený",
|
|
75
|
+
"error.validation.positive": "Musí to být kladné číslo",
|
|
76
|
+
"error.validation.regex": "Regex vzor není platný",
|
|
77
|
+
"error.validation.relation.targetAttribute-taken": "Tento název už v cíli existuje",
|
|
53
78
|
"form.attribute.component.option.add": "Přidat komponent",
|
|
54
79
|
"form.attribute.component.option.create": "Vytvořit nový komponent",
|
|
55
80
|
"form.attribute.component.option.create.description": "Komponent je dostupný mezi všemi typy a komponenty.",
|
|
@@ -61,14 +86,19 @@ var cs = {
|
|
|
61
86
|
"form.attribute.component.option.single.description": "Vhodné pro seskupení políček, např. celá adresa",
|
|
62
87
|
"form.attribute.item.customColumnName": "Vlastné názvy stĺpcov",
|
|
63
88
|
"form.attribute.item.customColumnName.description": "Umožňuje přejmenovat databázový sloupec pro potřeby API",
|
|
89
|
+
"form.attribute.item.date.type.date": "date (např.: 01/01/{currentYear})",
|
|
90
|
+
"form.attribute.item.date.type.datetime": "datetime (např.: 01/01/{currentYear} 00:00 AM)",
|
|
91
|
+
"form.attribute.item.date.type.time": "time (např.: 00:00 AM)",
|
|
64
92
|
"form.attribute.item.defineRelation.fieldName": "Název pole",
|
|
65
93
|
"form.attribute.item.enumeration.graphql": "Název pole pro GraphQL",
|
|
66
94
|
"form.attribute.item.enumeration.graphql.description": "Umožňuje přepsat přednastavené názvy názvy pro GraphQL",
|
|
67
95
|
"form.attribute.item.enumeration.placeholder": "Např.:\nráno\nden\nvečer",
|
|
68
96
|
"form.attribute.item.enumeration.rules": "Hodnoty (jedna na řádek)",
|
|
69
97
|
"form.attribute.item.maximum": "Maximální hodnota",
|
|
98
|
+
"form.attribute.item.maximumComponents": "Maximum komponent",
|
|
70
99
|
"form.attribute.item.maximumLength": "Maximální délka",
|
|
71
100
|
"form.attribute.item.minimum": "Minimální hodnota",
|
|
101
|
+
"form.attribute.item.minimumComponents": "Minimum komponent",
|
|
72
102
|
"form.attribute.item.minimumLength": "Minimální délka",
|
|
73
103
|
"form.attribute.item.number.type": "Číselný formát",
|
|
74
104
|
"form.attribute.item.number.type.biginteger": "velké číslo (např.: 123456789)",
|
|
@@ -79,8 +109,16 @@ var cs = {
|
|
|
79
109
|
"form.attribute.item.privateField.description": "Toto pole se nebude zobrazovat v API",
|
|
80
110
|
"form.attribute.item.requiredField": "Povinné pole",
|
|
81
111
|
"form.attribute.item.requiredField.description": "Nedovolí vytvořit záznam když toto pole zůstane prázdne",
|
|
112
|
+
"form.attribute.item.text.regex": "RegExp vzor",
|
|
113
|
+
"form.attribute.item.text.regex.description": "Text regulárního výrazu",
|
|
82
114
|
"form.attribute.item.uniqueField": "Unikátní pole",
|
|
83
115
|
"form.attribute.item.uniqueField.description": "Nedovolí vytvořit záznam když už existuje jiný záznam se stejnou hodnotou",
|
|
116
|
+
"form.attribute.item.uniqueField.v5.willBeDisabled'": "Aktuálně unikátní pole nefungují správně v komponentech. Pokud tuto funkci vypnete, pole bude deaktivováno, dokud to nebude opraveno.",
|
|
117
|
+
"form.attribute.item.uniqueField.v5.disabled": "Aktuálně unikátní pole nefungují správně v komponentech. Toto pole bylo deaktivováno, dokud to nebude opraveno.",
|
|
118
|
+
"form.attribute.media.allowed-types": "Vyberte povolené typy médií",
|
|
119
|
+
"form.attribute.media.allowed-types.option-files": "Soubory",
|
|
120
|
+
"form.attribute.media.allowed-types.option-images": "Obrázky",
|
|
121
|
+
"form.attribute.media.allowed-types.option-videos": "Videa",
|
|
84
122
|
"form.attribute.media.option.multiple": "Více souborů",
|
|
85
123
|
"form.attribute.media.option.multiple.description": "Vhodné pro galerii, seznam souborů na stáhnutí",
|
|
86
124
|
"form.attribute.media.option.single": "Jeden soubor",
|
|
@@ -90,35 +128,85 @@ var cs = {
|
|
|
90
128
|
"form.attribute.text.option.long-text.description": "Vhodné pro delší popisy. Přesné vyhledávání je vypnuté.",
|
|
91
129
|
"form.attribute.text.option.short-text": "Krátky text",
|
|
92
130
|
"form.attribute.text.option.short-text.description": "Vhodné pro nadpisy, názvy, URL adresy. Přesné vyhledávání je zapnuté.",
|
|
131
|
+
"form.attribute.condition.title": "Podmínka",
|
|
132
|
+
"form.attribute.condition.description": "Přepněte nastavení pole podle hodnoty jiného boolean nebo enum pole.",
|
|
133
|
+
"form.attribute.condition.label": "Podmínky",
|
|
134
|
+
"form.attribute.condition.field": "Pole",
|
|
135
|
+
"form.attribute.condition.operator": "Operátor",
|
|
136
|
+
"form.attribute.condition.value": "Hodnota",
|
|
137
|
+
"form.attribute.condition.operator.is": "je",
|
|
138
|
+
"form.attribute.condition.operator.isNot": "není",
|
|
139
|
+
"form.attribute.condition.value.true": "true",
|
|
140
|
+
"form.attribute.condition.value.false": "false",
|
|
141
|
+
"form.attribute.condition.apply": "Použít podmínku",
|
|
142
|
+
"form.attribute.condition.then": "Pak",
|
|
143
|
+
"form.attribute.condition.action": "Akce",
|
|
144
|
+
"form.attribute.condition.action.show": "Zobrazit",
|
|
145
|
+
"form.attribute.condition.action.hide": "Skrýt",
|
|
146
|
+
"form.attribute.condition.no-fields": "Nejsou k dispozici žádná boolean ani enum pole, pro která by bylo možné nastavit podmínky.",
|
|
147
|
+
"form.attribute.condition.enum-change-warning": "Následující pole mají podmínky, které závisí na tomto poli: {fieldNames}. Změna nebo odstranění enum hodnot {values} tyto podmínky poruší. Chcete pokračovat?",
|
|
148
|
+
"form.attribute.condition.enum-change-warning-values": ". Změna nebo odstranění enum hodnot ",
|
|
149
|
+
"form.attribute.condition.enum-change-warning-end": " poruší tyto podmínky. Chcete pokračovat?",
|
|
150
|
+
"form.attribute.condition.field-change-warning": "Následující pole mají podmínky, které závisí na tomto poli: {fieldNames}. Přejmenování tohoto pole tyto podmínky poruší. Chcete pokračovat?",
|
|
151
|
+
"form.attribute.condition.field-change-warning-end": ". Přejmenování tohoto pole tyto podmínky poruší. Chcete pokračovat?",
|
|
93
152
|
"form.button.add-components-to-dynamiczone": "Přidat komponenty do zóny",
|
|
94
153
|
"form.button.add-field": "Přidat další pole",
|
|
95
154
|
"form.button.add-first-field-to-created-component": "Přidat první pole do komponentu",
|
|
155
|
+
"form.button.add.field.to.collectionType": "Přidat další pole do tohoto collection type",
|
|
96
156
|
"form.button.add.field.to.component": "Přidat další pole do komponentu",
|
|
157
|
+
"form.button.add.field.to.contentType": "Přidat další pole do tohoto content type",
|
|
158
|
+
"form.button.add.field.to.singleType": "Přidat další pole do tohoto single type",
|
|
97
159
|
"form.button.cancel": "Zrušit",
|
|
160
|
+
"form.button.submit": "Odeslat",
|
|
161
|
+
"form.button.collection-type.description": "Nejlepší pro více instancí, jako jsou články, produkty, komentáře atd.",
|
|
162
|
+
"form.button.collection-type.name": "Collection Type",
|
|
98
163
|
"form.button.configure-component": "Nastavit komponent",
|
|
99
164
|
"form.button.configure-view": "Upravit vzhled",
|
|
100
165
|
"form.button.select-component": "Vybrat komponent",
|
|
166
|
+
"form.button.single-type.description": "Nejlepší pro jednu instanci, jako jsou o nás, domovská stránka atd.",
|
|
167
|
+
"form.button.single-type.name": "Single Type",
|
|
101
168
|
from: from,
|
|
169
|
+
"menu.section.components.name": "Komponenty",
|
|
170
|
+
"menu.section.models.name": "Collection Types",
|
|
171
|
+
"menu.section.single-types.name": "Single Types",
|
|
102
172
|
"modalForm.attribute.form.base.name.description": "Mezery v názvu pole nejsou povoleny",
|
|
173
|
+
"modalForm.attribute.form.base.name.placeholder": "např. slug, seoUrl, canonicalUrl",
|
|
174
|
+
"modalForm.attribute.target-field": "Připojené pole",
|
|
103
175
|
"modalForm.attributes.select-component": "Vyberte komponent",
|
|
104
176
|
"modalForm.attributes.select-components": "Vyberte komponenty",
|
|
177
|
+
"modalForm.collectionType.header-create": "Vytvořit collection type",
|
|
105
178
|
"modalForm.component.header-create": "Vytvorte komponent",
|
|
106
179
|
"modalForm.components.create-component.category.label": "Vyberte kategorii nebo zadejte název pro vytvoření nové",
|
|
107
180
|
"modalForm.components.icon.label": "Ikona",
|
|
181
|
+
"modalForm.empty.button": "Přidat vlastní pole",
|
|
182
|
+
"modalForm.empty.heading": "Zatím tu nic není.",
|
|
183
|
+
"modalForm.empty.sub-heading": "Najděte, co hledáte, prostřednictvím široké škály rozšíření.",
|
|
108
184
|
"modalForm.editCategory.base.name.description": "Mezery v názvu kategorie nejsou povoleny",
|
|
109
185
|
"modalForm.header-edit": "Upravit {name}",
|
|
110
186
|
"modalForm.header.categories": "Kategorie",
|
|
111
187
|
"modalForm.header.back": "Zadní",
|
|
188
|
+
"modalForm.singleType.header-create": "Vytvořit single type",
|
|
112
189
|
"modalForm.sub-header.addComponentToDynamicZone": "Přidat nový komponent do dynamické zóny",
|
|
113
190
|
"modalForm.sub-header.attribute.create": "Přidat nové pole {type}",
|
|
114
191
|
"modalForm.sub-header.attribute.create.step": "Přidat nový komponent ({step}/2)",
|
|
115
192
|
"modalForm.sub-header.attribute.edit": "Upravit {name}",
|
|
116
193
|
"modalForm.sub-header.chooseAttribute.collectionType": "Vyberte typ pole pro Typ obsahu",
|
|
117
194
|
"modalForm.sub-header.chooseAttribute.component": "Vyberte typ pole pro komponent",
|
|
195
|
+
"modalForm.sub-header.chooseAttribute.singleType": "Vyberte pole pro svůj single type",
|
|
196
|
+
"modalForm.custom-fields.advanced.settings.extended": "Rozšířená nastavení",
|
|
197
|
+
"modalForm.tabs.custom": "Vlastní",
|
|
198
|
+
"modalForm.tabs.custom.howToLink": "Jak přidat vlastní pole",
|
|
199
|
+
"modalForm.tabs.default": "Výchozí",
|
|
200
|
+
"modalForm.tabs.label": "Záložky výchozích a vlastních typů",
|
|
201
|
+
"modelPage.attribute.relation-polymorphic": "Relace (polymorfní)",
|
|
118
202
|
"modelPage.attribute.relationWith": "Propojení s",
|
|
203
|
+
"modelPage.attribute.with": "s",
|
|
204
|
+
"notification.error.dynamiczone-min.validation": "Alespoň jeden komponent je v dynamické zóně povinný, aby bylo možné uložit typ obsahu",
|
|
205
|
+
"notification.info.autoreaload-disable": "Strapi je v produkčním režimu, úprava content types je zakázána. Přepněte se prosím do vývojového režimu spuštěním serveru pomocí strapi develop.",
|
|
119
206
|
"notification.info.creating.notSaved": "Uložte změny před vytvořením nového Typu obsahu nebo komponentu",
|
|
120
207
|
"plugin.description.long": "Navrhněte strukturu webu jednoduše. Vytvořte nová pole a propojení během pár sekund. Soubory se automaticky vytvoří a upraví v rámci projektu.",
|
|
121
208
|
"plugin.description.short": "Navrhněte strukturu webu jednoduše.",
|
|
209
|
+
"plugin.name": "Content-Type Builder",
|
|
122
210
|
"popUpForm.navContainer.advanced": "Pokročilá nastavení",
|
|
123
211
|
"popUpForm.navContainer.base": "Základní nastavení",
|
|
124
212
|
"popUpWarning.bodyMessage.cancel-modifications": "Jste si jisti, že chcete zrušit úpravy?",
|
|
@@ -126,6 +214,13 @@ var cs = {
|
|
|
126
214
|
"popUpWarning.bodyMessage.category.delete": "Jste si jisti, že chcete odstranit tuto kategorii? Všechny komponentu budou rovněž odstraněny.",
|
|
127
215
|
"popUpWarning.bodyMessage.component.delete": "Jste si jisti, že chcete odstranit tento komponent?",
|
|
128
216
|
"popUpWarning.bodyMessage.contentType.delete": "Jste si jisti, že chcete odstranit tento Typ obsahu?",
|
|
217
|
+
"popUpWarning.draft-publish.button.confirm": "Ano, zakázat",
|
|
218
|
+
"popUpWarning.draft-publish.message": "Pokud vypnete Draft & publish, vaše drafty budou smazány.",
|
|
219
|
+
"popUpWarning.draft-publish.second-message": "Opravdu to chcete zakázat?",
|
|
220
|
+
"popUpWarning.discardAll.message": "Opravdu chcete zahodit všechny změny?",
|
|
221
|
+
"popUpWarning.bodyMessage.delete-condition": "Opravdu chcete smazat tuto podmínku?",
|
|
222
|
+
"popUpWarning.bodyMessage.delete-attribute-with-conditions": "Následující pole mají podmínky, které závisí na tomto poli: ",
|
|
223
|
+
"popUpWarning.bodyMessage.delete-attribute-with-conditions-end": ". Opravdu ho chcete smazat?",
|
|
129
224
|
"prompt.unsaved": "Jste si jisti, že chcete odejít? Všechny úpravy budou ztraceny.",
|
|
130
225
|
"relation.attributeName.placeholder": "Např: autor, kategorie, tag",
|
|
131
226
|
"relation.manyToMany": "má víc a patří všem",
|
|
@@ -133,7 +228,68 @@ var cs = {
|
|
|
133
228
|
"relation.manyWay": "má víc",
|
|
134
229
|
"relation.oneToMany": "patří více",
|
|
135
230
|
"relation.oneToOne": "má jeden a patří jednomu",
|
|
136
|
-
"relation.oneWay": "má jeden"
|
|
231
|
+
"relation.oneWay": "má jeden",
|
|
232
|
+
"table.button.no-fields": "Přidat nové pole",
|
|
233
|
+
"table.content.create-first-content-type.title": "Žádné content types",
|
|
234
|
+
"table.content.create-first-content-type.description": "Vytvořte collection types, single types a komponenty, abyste mohli vytvořit své schéma.",
|
|
235
|
+
"table.content.create-first-content-type.import-code": "Importovat z počítače",
|
|
236
|
+
"table.content.create-first-content-type.start-with-prompt": "Začít pomocí promptu",
|
|
237
|
+
"table.content.no-fields.collection-type": "Přidejte první pole do tohoto Collection-Type",
|
|
238
|
+
"table.content.no-fields.component": "Přidejte první pole do tohoto komponentu",
|
|
239
|
+
"IconPicker.search.placeholder.label": "Hledat ikonu",
|
|
240
|
+
"IconPicker.search.clear.label": "Vymazat hledání ikony",
|
|
241
|
+
"IconPicker.search.button.label": "Tlačítko hledání ikony",
|
|
242
|
+
"IconPicker.remove.tooltip": "Odstranit vybranou ikonu",
|
|
243
|
+
"IconPicker.remove.button": "Tlačítko pro odstranění vybrané ikony",
|
|
244
|
+
"IconPicker.emptyState.label": "Nebyla nalezena žádná ikona",
|
|
245
|
+
"IconPicker.icon.label": "Vybrat ikonu {icon}",
|
|
246
|
+
"chat.tooltips.close-chat": "Zavřít chat",
|
|
247
|
+
"chat.tooltips.create-chat": "Nová konverzace",
|
|
248
|
+
"chat.tooltips.open-chat": "Otevřít chat",
|
|
249
|
+
"chat.tooltips.send-message": "Odeslat",
|
|
250
|
+
"chat.tooltips.stop-generation": "Zastavit",
|
|
251
|
+
"chat.tooltips.upload-attachments": "Nahrát přílohy",
|
|
252
|
+
"chat.header.default-title": "Nová konverzace",
|
|
253
|
+
"chat.input.defaults.title": "Jak vám mohu pomoci?",
|
|
254
|
+
"chat.input.defaults.generate": "Vygenerovat schéma produktu",
|
|
255
|
+
"chat.input.defaults.ctb": "Řekni mi o Content-Type Builderu",
|
|
256
|
+
"chat.input.defaults.strapi": "Řekni mi o Strapi",
|
|
257
|
+
"chat.input.thinking": "Strapi AI přemýšlí...",
|
|
258
|
+
"chat.input.placeholder": "Zeptejte se Strapi AI...",
|
|
259
|
+
"chat.input.strapi-ai-can-make-errors": "Strapi AI může dělat chyby.",
|
|
260
|
+
"chat.messages.error": "Něco se pokazilo.",
|
|
261
|
+
"chat.messages.too-many-requests": "Příliš mnoho požadavků, zkuste to prosím později.",
|
|
262
|
+
"chat.messages.license-limit-reached": "Byl dosažen licenční limit, zkuste to prosím zítra znovu.",
|
|
263
|
+
"chat.messages.license-limit-exceeded": "Limit AI kreditů byl překročen.",
|
|
264
|
+
"chat.messages.too-long-error": "Tato konverzace dosáhla maximální délky. Začněte novou konverzaci",
|
|
265
|
+
"chat.code-upload.header": "Importovat kód",
|
|
266
|
+
"chat.code-upload.title": "Importovat kód",
|
|
267
|
+
"chat.code-upload.description": "Vaše aplikace bude analyzována AI. Před importem se ujistěte, že jste odstranili všechna citlivá data.",
|
|
268
|
+
"chat.code-upload.drop-zone": "Přetáhněte sem soubor .zip nebo",
|
|
269
|
+
"chat.code-upload.drop-zone-folder": "Přetáhněte sem složku nebo",
|
|
270
|
+
"chat.code-upload.drop-zone-browse": "procházet soubory",
|
|
271
|
+
"chat.attachments.menu.import-code": "Importovat kód",
|
|
272
|
+
"chat.attachments.menu.attach-image": "Připojit obrázek",
|
|
273
|
+
"chat.attachments.menu.import-figma": "Importovat z Figma",
|
|
274
|
+
"chat.feedback.title": "Poskytnout zpětnou vazbu",
|
|
275
|
+
"chat.feedback.subtitle": "Poskytněte další zpětnou vazbu k této zprávě. Vyberte vše, co platí.",
|
|
276
|
+
"chat.feedback.comment.label": "Jak se můžeme zlepšit? (volitelné)",
|
|
277
|
+
"chat.feedback.placeholder": "Vaše zpětná vazba...",
|
|
278
|
+
"chat.feedback.submitted": "Děkujeme za vaši zpětnou vazbu!",
|
|
279
|
+
"chat.feedback.error": "Při odesílání vaší zpětné vazby došlo k chybě",
|
|
280
|
+
"chat.feedback.reason.invalid_schema": "Neplatné schéma",
|
|
281
|
+
"chat.feedback.reason.bad_recommendation": "Špatné doporučení",
|
|
282
|
+
"chat.feedback.reason.slow": "Pomalé",
|
|
283
|
+
"chat.feedback.reason.instructions_ignored": "Pokyny byly ignorovány",
|
|
284
|
+
"chat.feedback.reason.being_lazy": "Líné",
|
|
285
|
+
"chat.feedback.reason.other": "Jiné",
|
|
286
|
+
"chat.figma-upload.step1-title": "Zadejte Figma URL",
|
|
287
|
+
"chat.figma-upload.step2-title": "Náhled obrázků",
|
|
288
|
+
"chat.figma-upload.select-images": "Vyberte Frames k importu",
|
|
289
|
+
"chat.figma-upload.no-images": "V souboru Figma nebyly nalezeny žádné frames.",
|
|
290
|
+
"chat.figma-upload.import-button": "Importovat",
|
|
291
|
+
"form.button.finish": "Dokončit",
|
|
292
|
+
"form.button.back": "Zpět"
|
|
137
293
|
};
|
|
138
294
|
|
|
139
295
|
exports.configurations = configurations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cs.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cs.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|