@ -1,7 +1,7 @@
|
||||
import { createAction, option } from '@typebot.io/forge'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
import { ZemanticAiResponse } from '../types'
|
||||
import { got } from 'got'
|
||||
import ky from 'ky'
|
||||
import { apiBaseUrl } from '../constants'
|
||||
import { auth } from '../auth'
|
||||
import { baseOptions } from '../baseOptions'
|
||||
@ -63,7 +63,7 @@ export const searchDocuments = createAction({
|
||||
},
|
||||
variables,
|
||||
}) => {
|
||||
const res: ZemanticAiResponse = await got
|
||||
const res = await ky
|
||||
.post(apiBaseUrl, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
@ -79,7 +79,7 @@ export const searchDocuments = createAction({
|
||||
},
|
||||
},
|
||||
})
|
||||
.json()
|
||||
.json<ZemanticAiResponse>()
|
||||
|
||||
responseMapping?.forEach((mapping) => {
|
||||
if (!mapping.variableId || !mapping.item) return
|
||||
|
@ -8,6 +8,7 @@ export const auth = {
|
||||
label: 'API key',
|
||||
isRequired: true,
|
||||
placeholder: 'ze...',
|
||||
inputType: 'password',
|
||||
helperText:
|
||||
'You can generate an API key [here](https://zemantic.ai/dashboard/settings).',
|
||||
isDebounceDisabled: true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createBlock } from '@typebot.io/forge'
|
||||
import { ZemanticAiLogo } from './logo'
|
||||
import { got } from 'got'
|
||||
import ky from 'ky'
|
||||
import { searchDocuments } from './actions/searchDocuments'
|
||||
import { auth } from './auth'
|
||||
import { baseOptions } from './baseOptions'
|
||||
@ -19,7 +19,7 @@ export const zemanticAiBlock = createBlock({
|
||||
fetch: async ({ credentials: { apiKey } }) => {
|
||||
const url = 'https://api.zemantic.ai/v1/projects'
|
||||
|
||||
const response = await got
|
||||
const response = await ky
|
||||
.get(url, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
|
@ -11,6 +11,6 @@
|
||||
"@types/react": "18.2.15",
|
||||
"typescript": "5.3.2",
|
||||
"@typebot.io/lib": "workspace:*",
|
||||
"got": "12.6.0"
|
||||
"ky": "1.2.3"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user