Explorar o código

机器人权限

CzRger hai 2 meses
pai
achega
b78cfb1f0a

+ 0 - 1
web/app/(commonLayout)/apps/AppCard.tsx

@@ -167,7 +167,6 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
       return
     }
     try {
-      console.log(1)
       const workflowDraft = await fetchWorkflowDraft(`/apps/${app.id}/workflows/draft`)
       const list = (workflowDraft.environment_variables || []).filter(env => env.value_type === 'secret')
       if (list.length === 0) {

+ 0 - 1
web/app/components/app-sidebar/app-info.tsx

@@ -143,7 +143,6 @@ const AppInfo = ({ expand }: IAppInfoProps) => {
       return
     }
     try {
-      console.log(2)
       const workflowDraft = await fetchWorkflowDraft(`/apps/${appDetail.id}/workflows/draft`)
       const list = (workflowDraft.environment_variables || []).filter(env => env.value_type === 'secret')
       if (list.length === 0) {

+ 3 - 2
web/app/components/workflow/hooks/use-nodes-sync-draft.ts

@@ -14,8 +14,10 @@ import {
 import { syncWorkflowDraft } from '@/service/workflow'
 import { useFeaturesStore } from '@/app/components/base/features/hooks'
 import { API_PREFIX } from '@/config'
+import { useAppDetailContext } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main'
 
 export const useNodesSyncDraft = () => {
+  const { detail, isCreate, isEdit, isOperation } = useAppDetailContext()
   const store = useStoreApi()
   const workflowStore = useWorkflowStore()
   const featuresStore = useFeaturesStore()
@@ -38,7 +40,7 @@ export const useNodesSyncDraft = () => {
       syncWorkflowDraftHash,
     } = workflowStore.getState()
 
-    if (appId) {
+    if (appId && isEdit) {
       const nodes = getNodes()
       const hasStartNode = nodes.find(node => node.data.type === BlockEnum.Start)
 
@@ -62,7 +64,6 @@ export const useNodesSyncDraft = () => {
           })
         })
       })
-      console.log(3)
       return {
         url: `/apps/${appId}/workflows/draft`,
         params: {

+ 0 - 2
web/app/components/workflow/hooks/use-workflow-interactions.ts

@@ -235,7 +235,6 @@ export const useWorkflowUpdate = () => {
       setConversationVariables,
     } = workflowStore.getState()
     setIsSyncingWorkflowDraft(true)
-    console.log(4)
     fetchWorkflowDraft(`/apps/${appId}/workflows/draft`).then((response) => {
       handleUpdateWorkflowCanvas(response.graph as WorkflowDataUpdater)
       setSyncWorkflowDraftHash(response.hash)
@@ -296,7 +295,6 @@ export const useDSL = () => {
     if (!appDetail)
       return
     try {
-      console.log(5)
       const workflowDraft = await fetchWorkflowDraft(`/apps/${appDetail?.id}/workflows/draft`)
       const list = (workflowDraft.environment_variables || []).filter(env => env.value_type === 'secret')
       if (list.length === 0) {

+ 3 - 2
web/app/components/workflow/hooks/use-workflow.ts

@@ -60,6 +60,7 @@ import { CUSTOM_ITERATION_START_NODE } from '@/app/components/workflow/nodes/ite
 import { CUSTOM_LOOP_START_NODE } from '@/app/components/workflow/nodes/loop-start/constants'
 import { useWorkflowConfig } from '@/service/use-workflow'
 import { canFindTool } from '@/utils'
+import { useAppDetailContext } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main'
 
 export const useIsChatMode = () => {
   const appDetail = useAppStore(s => s.appDetail)
@@ -472,6 +473,7 @@ export const useFetchToolsData = () => {
 }
 
 export const useWorkflowInit = () => {
+  const { detail, isCreate, isEdit, isOperation } = useAppDetailContext()
   const workflowStore = useWorkflowStore()
   const {
     nodes: nodesTemplate,
@@ -488,7 +490,7 @@ export const useWorkflowInit = () => {
 
   const handleGetInitialWorkflowData = useCallback(async () => {
     try {
-      console.log(6)
+      //  流程初始化
       const res = await fetchWorkflowDraft(`/apps/${appDetail.id}/workflows/draft`)
       setData(res)
       workflowStore.setState({
@@ -507,7 +509,6 @@ export const useWorkflowInit = () => {
         error.json().then((err: any) => {
           if (err.code === 'draft_workflow_not_exist') {
             workflowStore.setState({ notInitialWorkflow: true })
-            console.log(7)
             syncWorkflowDraft({
               url: `/apps/${appDetail.id}/workflows/draft`,
               params: {

+ 0 - 1
web/app/components/workflow/update-dsl-modal.tsx

@@ -87,7 +87,6 @@ const UpdateDSLModal = ({
       features,
       hash,
     } = await fetchWorkflowDraft(`/apps/${app_id}/workflows/draft`)
-    console.log(8)
     const { nodes, edges, viewport } = graph
     const newFeatures = {
       file: {