This commit is contained in:
Joel
2023-08-28 18:20:07 +08:00
parent a96399ee15
commit 4fa6b2c2bd
5 changed files with 21 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import { type NextRequest } from 'next/server'
import { ChatClient } from 'dify-client'
import { ChatClient, DifyClient } from 'dify-client'
import { v4 } from 'uuid'
import { API_KEY, API_URL, APP_ID } from '@/config'
@ -19,3 +19,4 @@ export const setSession = (sessionId: string) => {
}
export const client = new ChatClient(API_KEY, API_URL || undefined)
export const commonClient = new ChatClient(API_KEY, API_URL || undefined)

View File

@ -19,6 +19,7 @@ import Loading from '@/app/components/base/loading'
import { replaceVarWithValues, userInputsFormToPromptVariables } from '@/utils/prompt'
import AppUnavailable from '@/app/components/app-unavailable'
import { API_KEY, APP_ID, APP_INFO, isShowPrompt, promptTemplate } from '@/config'
import { checkOrSetAccessToken } from '@/utils/access-token'
const Main: FC = () => {
const { t } = useTranslation()
@ -197,6 +198,8 @@ const Main: FC = () => {
return
}
(async () => {
await checkOrSetAccessToken()
try {
const [conversationData, appParams] = await Promise.all([fetchConversations(), fetchAppParams()])