mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-03 17:40:41 +08:00
feat: after run all logic
This commit is contained in:
parent
82aca36fc1
commit
ae1868227c
@ -30,6 +30,9 @@ import {
|
|||||||
} from '@/app/components/base/file-uploader/utils'
|
} from '@/app/components/base/file-uploader/utils'
|
||||||
import type { FileEntity } from '@/app/components/base/file-uploader/types'
|
import type { FileEntity } from '@/app/components/base/file-uploader/types'
|
||||||
import { getThreadMessages } from '@/app/components/base/chat/utils'
|
import { getThreadMessages } from '@/app/components/base/chat/utils'
|
||||||
|
import { useInvalidAllLastRun } from '@/service/use-workflow'
|
||||||
|
import { useParams } from 'next/navigation'
|
||||||
|
import useSetWorkflowVarsWithValue from '@/app/components/workflow-app/hooks/use-fetch-workflow-inspect-vars'
|
||||||
|
|
||||||
type GetAbortController = (abortController: AbortController) => void
|
type GetAbortController = (abortController: AbortController) => void
|
||||||
type SendCallback = {
|
type SendCallback = {
|
||||||
@ -53,6 +56,9 @@ export const useChat = (
|
|||||||
const taskIdRef = useRef('')
|
const taskIdRef = useRef('')
|
||||||
const [isResponding, setIsResponding] = useState(false)
|
const [isResponding, setIsResponding] = useState(false)
|
||||||
const isRespondingRef = useRef(false)
|
const isRespondingRef = useRef(false)
|
||||||
|
const { appId } = useParams()
|
||||||
|
const invalidAllLastRun = useInvalidAllLastRun(appId as string)
|
||||||
|
const { fetchInspectVars } = useSetWorkflowVarsWithValue()
|
||||||
const [suggestedQuestions, setSuggestQuestions] = useState<string[]>([])
|
const [suggestedQuestions, setSuggestQuestions] = useState<string[]>([])
|
||||||
const suggestedQuestionsAbortControllerRef = useRef<AbortController | null>(null)
|
const suggestedQuestionsAbortControllerRef = useRef<AbortController | null>(null)
|
||||||
const {
|
const {
|
||||||
@ -288,6 +294,8 @@ export const useChat = (
|
|||||||
},
|
},
|
||||||
async onCompleted(hasError?: boolean, errorMessage?: string) {
|
async onCompleted(hasError?: boolean, errorMessage?: string) {
|
||||||
handleResponding(false)
|
handleResponding(false)
|
||||||
|
fetchInspectVars()
|
||||||
|
invalidAllLastRun()
|
||||||
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
if (errorMessage) {
|
if (errorMessage) {
|
||||||
|
@ -76,6 +76,7 @@ export const fetchCurrentValueOfConversationVariable: Fetcher<ConversationVariab
|
|||||||
|
|
||||||
export const fetchAllInspectVars = async (appId: string): Promise<VarInInspect[]> => {
|
export const fetchAllInspectVars = async (appId: string): Promise<VarInInspect[]> => {
|
||||||
// TODO: mock data. and need to get the rest data if has more data
|
// TODO: mock data. and need to get the rest data if has more data
|
||||||
|
console.log('fetchAllInspectVars', appId)
|
||||||
await sleep(1000)
|
await sleep(1000)
|
||||||
const data = await Promise.resolve({
|
const data = await Promise.resolve({
|
||||||
items: vars,
|
items: vars,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user