@deep-foundation/chatgpt-azure
Advanced tools
Comparing version 3.0.2 to 3.0.3
{ | ||
"package": { | ||
"name": "@deep-foundation/chatgpt-azure", | ||
"version": "3.0.2" | ||
"version": "3.0.3" | ||
}, | ||
@@ -137,3 +137,3 @@ "data": [ | ||
"value": { | ||
"value": "async ({ deep, require }) => {\n const PACKAGE_NAME = \"@deep-foundation/chatgpt-azure-discord-bot\";\n const logsPrefix = \"@chatgpt-azure\" + \" \" + \"manager\" + \"ClientHandler\";\n const React = await deep.import(\"react\");\n const { useState, useMemo, useRef } = React;\n const Chakra = await deep.import(\"@chakra-ui/react\");\n console.log(logsPrefix, { Chakra });\n const {\n Input,\n InputGroup,\n InputRightElement,\n IconButton,\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverBody,\n FormControl,\n FormLabel,\n Box,\n PopoverHeader,\n PopoverCloseButton,\n HStack,\n Stack,\n Text,\n Link,\n Select,\n Tooltip,\n Button,\n NumberInput,\n NumberInputField,\n FormHelperText,\n FormErrorMessage,\n Divider,\n } = Chakra;\n const ChakraIcons = await deep.import(\"@chakra-ui/icons\");\n const { InfoOutlineIcon } = ChakraIcons;\n console.log(logsPrefix, ChakraIcons);\n const DeepCase = await deep.import(\"@deep-foundation/deepcase\");\n const { FinderPopover } = await deep.import(\"./cyto/hooks\");\n const { ClientHandler } = DeepCase;\n console.log(logsPrefix, { DeepCase });\n console.log(logsPrefix, { FinderPopover });\n const ReactHookForm = await deep.import(\"react-hook-form\");\n console.log(logsPrefix, { ReactHookForm });\n const { useForm, Controller } = ReactHookForm;\n const containTypeLinkId = await deep.id(\"@deep-foundation/core\", \"Contain\");\n\n const chatGPTAzureClientHandlerLinkId = await deep.id(\n \"@deep-foundation/chatgpt-azure\",\n \"managerClientHandler\"\n );\n\n return ({ fillSize, style, link }) => {\n const {\n handleSubmit,\n register,\n formState: { errors, isSubmitting },\n control,\n setValue,\n setError,\n } = useForm();\n\n async function onSubmit(values: {\n apiKey: string;\n chatGPTModelLinkId: string;\n userLinkId: string;\n containerLinkId: string;\n }) {\n const { apiKey, chatGPTModelLinkId, userLinkId, containerLinkId } =\n values;\n\n const containTypeLinkId = await deep.id(\n \"@deep-foundation/core\",\n \"Contain\"\n );\n const reservedLinkIds = await deep.reserve(6);\n const apiKeyLinkId = reservedLinkIds.pop();\n const containForApiKeyLinkId = reservedLinkIds.pop();\n const usesApiKeyLinkId = reservedLinkIds.pop();\n const containForUsesApiKeyLinkId = reservedLinkIds.pop();\n const usesModelLinkId = reservedLinkIds.pop();\n const containForUsesModelLinkId = reservedLinkIds.pop();\n\n await deep\n .serial({\n operations: [\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: apiKeyLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"ApiKey\"),\n },\n },\n {\n type: \"insert\",\n table: \"strings\",\n objects: {\n link_id: apiKeyLinkId,\n value: apiKey,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForApiKeyLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: apiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: usesApiKeyLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"UsesApiKey\"),\n from_id: userLinkId,\n to_id: apiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForUsesApiKeyLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: usesApiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: usesModelLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"UsesModel\"),\n from_id: userLinkId,\n to_id: chatGPTModelLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForUsesModelLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: usesModelLinkId,\n },\n },\n ],\n })\n .catch(setError);\n }\n\n return (\n <Box\n style={{ minWidth: 450, ...style }}\n bg={\"bgColor\"}\n color={\"text\"}\n borderColor={\"borderColor\"}\n borderWidth=\"1px\"\n borderRadius=\"lg\"\n padding={4}\n >\n <form onSubmit={handleSubmit(onSubmit)}>\n <FormControl isInvalid={errors.root}>\n <Stack\n spacing={6}\n divider={<Divider />}\n display=\"flex\"\n justifyContent=\"center\"\n >\n <ApiKeyTextField\n register={register}\n error={errors.apiKey && errors.apiKey.message}\n />\n <ModelLinkIdSelect\n register={register}\n error={\n errors.chatGPTModelLinkId && errors.chatGPTModelLinkId.message\n }\n />\n <UserLinkIdTextField\n control={control}\n error={errors.userLinkId && errors.userLinkId.message}\n setValue={setValue}\n />\n <ContainerLinkIdTextField\n control={control}\n setValue={setValue}\n error={errors.containerLinkId && errors.containerLinkId.message}\n />\n {errors.root && <FormErrorMessage>\n {JSON.stringify(errors.root, null, 2)}\n </FormErrorMessage>}\n <Button isLoading={isSubmitting} type=\"submit\">\n Submit\n </Button>\n </Stack>\n </FormControl>\n </form>\n </Box>\n );\n };\n\n function ModelLinkIdSelect(options: { register: Function; error: string }) {\n const { register, error } = options;\n const { data: modelLinks } = deep.useDeepSubscription({\n type_id: {\n _id: [\"@deep-foundation/openai\", \"Model\"],\n },\n });\n\n const modelOptions = useMemo(() => {\n if (!modelLinks || modelLinks.length === 0) return null;\n return modelLinks.map((link) => {\n const name = link.value.value;\n return <option value={link.id}>{name}</option>;\n });\n }, [modelLinks]);\n console.log({ modelOptions });\n\n return (\n <Tooltip\n label={`No model links of type [\"@deep-foundation/openai\", \"Model\"] available to choose from. You can install \"@deep-foundation/chatgpt-azure-deep\" for already configured chatgpt models`}\n isDisabled={modelLinks.length > 0}\n >\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"chatGPTModelLinkId\">\n ChatGPT Model Link ID\n </FormLabel>\n <Select\n placeholder=\"ChatGPT Model link ID\"\n {...register(\"chatGPTModelLinkId\", {\n required: \"ChatGPT Model link ID is required\",\n })}\n isDisabled={modelLinks.length === 0}\n >\n {modelOptions}\n </Select>\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n ChatGPT model is required to know which model should be used for\n requests\n </FormHelperText>\n </FormControl>\n </Tooltip>\n );\n }\n\n // function ApiKeyTextField(options: {\n // apiKey: string;\n // handleApiKeyChange: (apiKey: string) => void;\n // }) {\n // const { apiKey: apiKey, handleApiKeyChange: handleApiKeyChange } = options;\n\n // const helpContent = (\n // <Stack>\n // <Text>\n // Api Key is required to make requests to discord on your behalf\n // </Text>\n // <Link\n // isExternal\n // href=\"https://discord.com/developers/docs/getting-started#configuring-your-bot\"\n // >\n // Obtain Api Key\n // </Link>\n // </Stack>\n // );\n\n // return (\n // <Stack>\n // <HStack>\n // <Input\n // placeholder=\"Enter Api Key\"\n // variant=\"outlined\"\n // value={apiKey}\n // onChange={(event) => {\n // handleApiKeyChange(event.target.value);\n // }}\n // />\n // <Popover>\n // <PopoverTrigger>\n // <IconButton aria-label=\"help\" icon={<InfoOutlineIcon />} />\n // </PopoverTrigger>\n // <PopoverContent>\n // <PopoverArrow />\n // <PopoverCloseButton />\n // <PopoverBody>{helpContent}</PopoverBody>\n // </PopoverContent>\n // </Popover>\n // </HStack>\n // </Stack>\n // );\n // }\n\n // function UserLinkIdTextField(options: {\n // userLinkId: number;\n // handleUserLinkIdChange: (value: number) => void;\n // }) {\n // const { userLinkId, handleUserLinkIdChange } = options;\n // const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n // const handleHelpClick = () => {\n // setIsPopoverOpen(!isPopoverOpen);\n // };\n\n // const helpContent = `User link is a link that is considered as a user of ApiKey. User link will be \"from\" for UsesApiKey`;\n\n // return (\n // <HStack>\n // <FormControl>\n // <InputGroup>\n // <Input\n // placeholder=\"User Link ID\"\n // type=\"text\"\n // variant=\"outline\"\n // value={userLinkId}\n // onChange={(event) => {\n // handleUserLinkIdChange(event.target.value);\n // }}\n // required\n // />\n // </InputGroup>\n // </FormControl>\n // <Popover>\n // <PopoverTrigger>\n // <IconButton aria-label=\"help\" icon={<InfoOutlineIcon />} />\n // </PopoverTrigger>\n // <PopoverContent>\n // <PopoverArrow />\n // <PopoverCloseButton />\n // <PopoverBody>{helpContent}</PopoverBody>\n // </PopoverContent>\n // </Popover>\n // <FinderPopover\n // link={deep.linkId}\n // onSubmit={async (link) => {\n // handleUserLinkIdChange(link.id);\n // }}\n // >\n // <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n // </FinderPopover>\n // </HStack>\n // );\n // }\n\n function ApiKeyTextField(options: { error: string; register: Function }) {\n const { error, register } = options;\n\n return (\n <HStack>\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"apiKey\">ApiKey Link ID</FormLabel>\n <Input\n {...register(\"apiKey\", {\n required: \"Api Key is required\",\n })}\n />\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n <Stack>\n <Text>\n Api Key is required to make requests to discord on your behalf\n </Text>\n <Link\n isExternal\n href=\"https://discord.com/developers/docs/getting-started#configuring-your-bot\"\n >\n Obtain Api Key\n </Link>\n </Stack>\n </FormHelperText>\n </FormControl>\n </HStack>\n );\n }\n\n function UserLinkIdTextField(options: {\n setValue: any;\n error: string;\n control: any;\n }) {\n const { setValue, error, control } = options;\n\n return (\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"userLinkId\">User Link ID</FormLabel>\n <Controller\n name=\"userLinkId\"\n control={control}\n defaultValue={undefined}\n rules={{\n required: {\n value: true,\n message: \"User link ID is required\",\n },\n validate: async (value) => {\n const valueNumber = parseInt(value);\n if (isNaN(valueNumber)) {\n return \"User link ID must be a number\";\n }\n const {\n data: [link],\n } = await deep.select({ id: valueNumber });\n if (!link) {\n return `Link ${valueNumber} does not exist`;\n } else {\n return true;\n }\n },\n }}\n render={({ field }) => (\n <HStack>\n <NumberInput {...field} min={0}>\n <NumberInputField ref={field.ref} name={field.name} />\n </NumberInput>\n <FinderPopover\n link={deep.linkId}\n onSubmit={async (link) => {\n setValue(\"containerLinkId\", link.id);\n }}\n >\n <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n </FinderPopover>\n </HStack>\n )}\n />\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n User link is a link that is considered as a user of ApiKey. User link\n will be \"from\" for UsesApiKey\n </FormHelperText>\n </FormControl>\n );\n }\n\n function ContainerLinkIdTextField(options: {\n setValue: any;\n error: string;\n control: any;\n }) {\n const { setValue, error, control } = options;\n\n const helpContent = `Container link is a link that will contain newly created ApiKey, UsesApiKey`;\n\n return (\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"containerLinkId\">Container Link ID</FormLabel>\n <HStack>\n <Controller\n name=\"containerLinkId\"\n control={control}\n defaultValue={undefined}\n rules={{\n required: {\n value: true,\n message: \"Container link id is required\",\n },\n validate: async (value) => {\n const valueNumber = parseInt(value);\n if (isNaN(valueNumber)) {\n return \"Container link id must be a number\";\n }\n const {\n data: [link],\n } = await deep.select({ id: valueNumber });\n if (!link) {\n return `Link ${valueNumber} does not exist`;\n } else {\n return true;\n }\n },\n }}\n render={({ field }) => (\n <NumberInput {...field} min={0}>\n <NumberInputField ref={field.ref} name={field.name} />\n </NumberInput>\n )}\n />\n <FinderPopover\n link={deep.linkId}\n onSubmit={async (link) => {\n setValue(\"containerLinkId\", link.id);\n }}\n >\n <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n </FinderPopover>\n </HStack>\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n Container link is a link that will contain newly created ApiKey,\n UsesApiKey\n </FormHelperText>\n </FormControl>\n );\n }\n};\n " | ||
"value": "async ({ deep, require }) => {\n const PACKAGE_NAME = \"@deep-foundation/chatgpt-azure-discord-bot\";\n const logsPrefix = \"@chatgpt-azure\" + \" \" + \"manager\" + \"ClientHandler\";\n const React = await deep.import(\"react\");\n const { useState, useMemo, useRef } = React;\n const Chakra = await deep.import(\"@chakra-ui/react\");\n console.log(logsPrefix, { Chakra });\n const {\n Input,\n InputGroup,\n InputRightElement,\n IconButton,\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverBody,\n FormControl,\n FormLabel,\n Box,\n PopoverHeader,\n PopoverCloseButton,\n HStack,\n Stack,\n Text,\n Link,\n Select,\n Tooltip,\n Button,\n NumberInput,\n NumberInputField,\n FormHelperText,\n FormErrorMessage,\n Divider,\n } = Chakra;\n const ChakraIcons = await deep.import(\"@chakra-ui/icons\");\n const { InfoOutlineIcon } = ChakraIcons;\n console.log(logsPrefix, ChakraIcons);\n const DeepCase = await deep.import(\"@deep-foundation/deepcase\");\n const { FinderPopover } = await deep.import(\"./cyto/hooks\");\n const { ClientHandler } = DeepCase;\n console.log(logsPrefix, { DeepCase });\n console.log(logsPrefix, { FinderPopover });\n const ReactHookForm = await deep.import(\"react-hook-form\");\n console.log(logsPrefix, { ReactHookForm });\n const { useForm, Controller } = ReactHookForm;\n const containTypeLinkId = await deep.id(\"@deep-foundation/core\", \"Contain\");\n\n const chatGPTAzureClientHandlerLinkId = await deep.id(\n \"@deep-foundation/chatgpt-azure\",\n \"managerClientHandler\"\n );\n\n return ({ fillSize, style, link }) => {\n const {\n handleSubmit,\n register,\n formState: { errors, isSubmitting },\n control,\n setValue,\n setError,\n } = useForm();\n\n async function onSubmit(values: {\n apiKey: string;\n chatGPTModelLinkId: string;\n userLinkId: string;\n containerLinkId: string;\n }) {\n const { apiKey, chatGPTModelLinkId, userLinkId, containerLinkId } =\n values;\n\n const containTypeLinkId = await deep.id(\n \"@deep-foundation/core\",\n \"Contain\"\n );\n const reservedLinkIds = await deep.reserve(6);\n const apiKeyLinkId = reservedLinkIds.pop();\n const containForApiKeyLinkId = reservedLinkIds.pop();\n const usesApiKeyLinkId = reservedLinkIds.pop();\n const containForUsesApiKeyLinkId = reservedLinkIds.pop();\n const usesModelLinkId = reservedLinkIds.pop();\n const containForUsesModelLinkId = reservedLinkIds.pop();\n\n await deep\n .serial({\n operations: [\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: apiKeyLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"ApiKey\"),\n },\n },\n {\n type: \"insert\",\n table: \"strings\",\n objects: {\n link_id: apiKeyLinkId,\n value: apiKey,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForApiKeyLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: apiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: usesApiKeyLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"UsesApiKey\"),\n from_id: userLinkId,\n to_id: apiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForUsesApiKeyLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: usesApiKeyLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: usesModelLinkId,\n type_id: await deep.id(\"@deep-foundation/openai\", \"UsesModel\"),\n from_id: userLinkId,\n to_id: chatGPTModelLinkId,\n },\n },\n {\n type: \"insert\",\n table: \"links\",\n objects: {\n id: containForUsesModelLinkId,\n type_id: containTypeLinkId,\n from_id: containerLinkId,\n to_id: usesModelLinkId,\n },\n },\n ],\n })\n .catch(setError);\n }\n\n return (\n <Box\n style={{ minWidth: 450, ...style }}\n bg={\"bgColor\"}\n color={\"text\"}\n borderColor={\"borderColor\"}\n borderWidth=\"1px\"\n borderRadius=\"lg\"\n padding={4}\n >\n <form onSubmit={handleSubmit(onSubmit)}>\n <FormControl isInvalid={errors.root}>\n <Stack\n spacing={6}\n divider={<Divider />}\n display=\"flex\"\n justifyContent=\"center\"\n >\n <ApiKeyTextField\n register={register}\n error={errors.apiKey && errors.apiKey.message}\n />\n <ModelLinkIdSelect\n register={register}\n error={\n errors.chatGPTModelLinkId && errors.chatGPTModelLinkId.message\n }\n />\n <UserLinkIdTextField\n control={control}\n error={errors.userLinkId && errors.userLinkId.message}\n setValue={setValue}\n />\n <ContainerLinkIdTextField\n control={control}\n setValue={setValue}\n error={errors.containerLinkId && errors.containerLinkId.message}\n />\n {errors.root && <FormErrorMessage>\n {JSON.stringify(errors.root, null, 2)}\n </FormErrorMessage>}\n <Button isLoading={isSubmitting} type=\"submit\">\n Submit\n </Button>\n </Stack>\n </FormControl>\n </form>\n </Box>\n );\n };\n\n function ModelLinkIdSelect(options: { register: Function; error: string }) {\n const { register, error } = options;\n const { data: modelLinks } = deep.useDeepSubscription({\n type_id: {\n _id: [\"@deep-foundation/openai\", \"Model\"],\n },\n });\n\n const modelOptions = useMemo(() => {\n if (!modelLinks || modelLinks.length === 0) return null;\n return modelLinks.map((link) => {\n const name = link.value.value;\n return <option value={link.id}>{name}</option>;\n });\n }, [modelLinks]);\n console.log({ modelOptions });\n\n return (\n <Tooltip\n label={`No model links of type [\"@deep-foundation/openai\", \"Model\"] available to choose from. You can install \"@deep-foundation/chatgpt-azure-deep\" for already configured chatgpt models`}\n isDisabled={modelLinks.length > 0}\n >\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"chatGPTModelLinkId\">\n ChatGPT Model Link ID\n </FormLabel>\n <Select\n placeholder=\"ChatGPT Model link ID\"\n {...register(\"chatGPTModelLinkId\", {\n required: \"ChatGPT Model link ID is required\",\n })}\n isDisabled={modelLinks.length === 0}\n >\n {modelOptions}\n </Select>\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n ChatGPT model is required to know which model should be used for\n requests\n </FormHelperText>\n </FormControl>\n </Tooltip>\n );\n }\n\n // function ApiKeyTextField(options: {\n // apiKey: string;\n // handleApiKeyChange: (apiKey: string) => void;\n // }) {\n // const { apiKey: apiKey, handleApiKeyChange: handleApiKeyChange } = options;\n\n // const helpContent = (\n // <Stack>\n // <Text>\n // Api Key is required to make requests to discord on your behalf\n // </Text>\n // <Link\n // isExternal\n // href=\"https://discord.com/developers/docs/getting-started#configuring-your-bot\"\n // >\n // Obtain Api Key\n // </Link>\n // </Stack>\n // );\n\n // return (\n // <Stack>\n // <HStack>\n // <Input\n // placeholder=\"Enter Api Key\"\n // variant=\"outlined\"\n // value={apiKey}\n // onChange={(event) => {\n // handleApiKeyChange(event.target.value);\n // }}\n // />\n // <Popover>\n // <PopoverTrigger>\n // <IconButton aria-label=\"help\" icon={<InfoOutlineIcon />} />\n // </PopoverTrigger>\n // <PopoverContent>\n // <PopoverArrow />\n // <PopoverCloseButton />\n // <PopoverBody>{helpContent}</PopoverBody>\n // </PopoverContent>\n // </Popover>\n // </HStack>\n // </Stack>\n // );\n // }\n\n // function UserLinkIdTextField(options: {\n // userLinkId: number;\n // handleUserLinkIdChange: (value: number) => void;\n // }) {\n // const { userLinkId, handleUserLinkIdChange } = options;\n // const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n // const handleHelpClick = () => {\n // setIsPopoverOpen(!isPopoverOpen);\n // };\n\n // const helpContent = `User link is a link that is considered as a user of ApiKey. User link will be \"from\" for UsesApiKey`;\n\n // return (\n // <HStack>\n // <FormControl>\n // <InputGroup>\n // <Input\n // placeholder=\"User Link ID\"\n // type=\"text\"\n // variant=\"outline\"\n // value={userLinkId}\n // onChange={(event) => {\n // handleUserLinkIdChange(event.target.value);\n // }}\n // required\n // />\n // </InputGroup>\n // </FormControl>\n // <Popover>\n // <PopoverTrigger>\n // <IconButton aria-label=\"help\" icon={<InfoOutlineIcon />} />\n // </PopoverTrigger>\n // <PopoverContent>\n // <PopoverArrow />\n // <PopoverCloseButton />\n // <PopoverBody>{helpContent}</PopoverBody>\n // </PopoverContent>\n // </Popover>\n // <FinderPopover\n // link={deep.linkId}\n // onSubmit={async (link) => {\n // handleUserLinkIdChange(link.id);\n // }}\n // >\n // <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n // </FinderPopover>\n // </HStack>\n // );\n // }\n\n function ApiKeyTextField(options: { error: string; register: Function }) {\n const { error, register } = options;\n\n return (\n <HStack>\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"apiKey\">ApiKey Link ID</FormLabel>\n <Input\n {...register(\"apiKey\", {\n required: \"Api Key is required\",\n })}\n />\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n <Stack>\n <Text>\n Api Key is required to make requests to openai on your behalf\n </Text>\n <Link\n isExternal\n href=\"https://platform.openai.com/api-keys\"\n >\n Obtain Api Key\n </Link>\n </Stack>\n </FormHelperText>\n </FormControl>\n </HStack>\n );\n }\n\n function UserLinkIdTextField(options: {\n setValue: any;\n error: string;\n control: any;\n }) {\n const { setValue, error, control } = options;\n\n return (\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"userLinkId\">User Link ID</FormLabel>\n <Controller\n name=\"userLinkId\"\n control={control}\n defaultValue={undefined}\n rules={{\n required: {\n value: true,\n message: \"User link ID is required\",\n },\n validate: async (value) => {\n const valueNumber = parseInt(value);\n if (isNaN(valueNumber)) {\n return \"User link ID must be a number\";\n }\n const {\n data: [link],\n } = await deep.select({ id: valueNumber });\n if (!link) {\n return `Link ${valueNumber} does not exist`;\n } else {\n return true;\n }\n },\n }}\n render={({ field }) => (\n <HStack>\n <NumberInput {...field} min={0}>\n <NumberInputField ref={field.ref} name={field.name} />\n </NumberInput>\n <FinderPopover\n link={deep.linkId}\n onSubmit={async (link) => {\n setValue(\"containerLinkId\", link.id);\n }}\n >\n <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n </FinderPopover>\n </HStack>\n )}\n />\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n User link is a link that is considered as a user of ApiKey. User link\n will be \"from\" for UsesApiKey\n </FormHelperText>\n </FormControl>\n );\n }\n\n function ContainerLinkIdTextField(options: {\n setValue: any;\n error: string;\n control: any;\n }) {\n const { setValue, error, control } = options;\n\n const helpContent = `Container link is a link that will contain newly created ApiKey, UsesApiKey`;\n\n return (\n <FormControl isInvalid={error}>\n <FormLabel htmlFor=\"containerLinkId\">Container Link ID</FormLabel>\n <HStack>\n <Controller\n name=\"containerLinkId\"\n control={control}\n defaultValue={undefined}\n rules={{\n required: {\n value: true,\n message: \"Container link id is required\",\n },\n validate: async (value) => {\n const valueNumber = parseInt(value);\n if (isNaN(valueNumber)) {\n return \"Container link id must be a number\";\n }\n const {\n data: [link],\n } = await deep.select({ id: valueNumber });\n if (!link) {\n return `Link ${valueNumber} does not exist`;\n } else {\n return true;\n }\n },\n }}\n render={({ field }) => (\n <NumberInput {...field} min={0}>\n <NumberInputField ref={field.ref} name={field.name} />\n </NumberInput>\n )}\n />\n <FinderPopover\n link={deep.linkId}\n onSubmit={async (link) => {\n setValue(\"containerLinkId\", link.id);\n }}\n >\n <IconButton aria-label=\"finder\" icon={<>🪬</>} />\n </FinderPopover>\n </HStack>\n <FormErrorMessage>{error}</FormErrorMessage>\n <FormHelperText>\n Container link is a link that will contain newly created ApiKey,\n UsesApiKey\n </FormHelperText>\n </FormControl>\n );\n }\n};\n" | ||
} | ||
@@ -140,0 +140,0 @@ }, |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"keywords": [ | ||
@@ -15,0 +15,0 @@ "deep-package" |
34336
337