Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
403c2f43
Commit
403c2f43
authored
Feb 27, 2024
by
takatost
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove publish workflow when app import
parent
594de43d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
app_service.py
api/services/app_service.py
+2
-5
workflow_service.py
api/services/workflow_service.py
+30
-4
No files found.
api/services/app_service.py
View file @
403c2f43
...
...
@@ -155,10 +155,9 @@ class AppService:
db
.
session
.
commit
()
if
workflow_graph
:
# init draft workflow
workflow_service
=
WorkflowService
()
draft_workflow
=
workflow_service
.
sync_draft_workflow
(
app
,
workflow_graph
,
account
)
published_workflow
=
workflow_service
.
publish_draft_workflow
(
app
,
account
,
draft_workflow
)
model_config_data
[
'workflow_id'
]
=
published_workflow
.
id
workflow_service
.
sync_draft_workflow
(
app
,
workflow_graph
,
account
)
app_model_config
=
AppModelConfig
()
app_model_config
=
app_model_config
.
from_model_config_dict
(
model_config_data
)
...
...
@@ -282,5 +281,3 @@ class AppService:
# conversations, pinned_conversations, messages BY app
# message_feedbacks, message_annotations, message_chains BY message
# message_agent_thoughts, message_files, saved_messages BY message
api/services/workflow_service.py
View file @
403c2f43
...
...
@@ -59,11 +59,11 @@ class WorkflowService:
# return draft workflow
return
workflow
def
publish_
draft_
workflow
(
self
,
app_model
:
App
,
account
:
Account
,
draft_workflow
:
Optional
[
Workflow
]
=
None
)
->
Workflow
:
def
publish_workflow
(
self
,
app_model
:
App
,
account
:
Account
,
draft_workflow
:
Optional
[
Workflow
]
=
None
)
->
Workflow
:
"""
Publish
draft workflow
Publish
workflow from draft
:param app_model: App instance
:param account: Account instance
...
...
@@ -76,6 +76,8 @@ class WorkflowService:
if
not
draft_workflow
:
raise
ValueError
(
'No valid workflow found.'
)
# TODO check if the workflow is valid
# create new workflow
workflow
=
Workflow
(
tenant_id
=
app_model
.
tenant_id
,
...
...
@@ -90,6 +92,30 @@ class WorkflowService:
db
.
session
.
add
(
workflow
)
db
.
session
.
commit
()
app_model_config
=
app_model
.
app_model_config
# create new app model config record
new_app_model_config
=
app_model_config
.
copy
()
new_app_model_config
.
id
=
None
new_app_model_config
.
app_id
=
app_model
.
id
new_app_model_config
.
external_data_tools
=
''
new_app_model_config
.
model
=
''
new_app_model_config
.
user_input_form
=
''
new_app_model_config
.
dataset_query_variable
=
None
new_app_model_config
.
pre_prompt
=
None
new_app_model_config
.
agent_mode
=
''
new_app_model_config
.
prompt_type
=
'simple'
new_app_model_config
.
chat_prompt_config
=
''
new_app_model_config
.
completion_prompt_config
=
''
new_app_model_config
.
dataset_configs
=
''
new_app_model_config
.
workflow_id
=
workflow
.
id
db
.
session
.
add
(
new_app_model_config
)
db
.
session
.
flush
()
app_model
.
app_model_config_id
=
new_app_model_config
.
id
db
.
session
.
commit
()
# return new workflow
return
workflow
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment