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
16424d42
Commit
16424d42
authored
Jul 12, 2023
by
crazywoola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add delete conversation in service api
parent
fec607db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
app.py
api/app.py
+4
-0
conversation.py
api/controllers/service_api/app/conversation.py
+5
-5
No files found.
api/app.py
View file @
16424d42
...
...
@@ -149,6 +149,10 @@ def register_blueprints(app):
from
controllers.web
import
bp
as
web_bp
from
controllers.console
import
bp
as
console_app_bp
CORS
(
service_api_bp
,
allow_headers
=
[
'Content-Type'
,
'Authorization'
,
'X-App-Code'
],
methods
=
[
'GET'
,
'PUT'
,
'POST'
,
'DELETE'
,
'OPTIONS'
,
'PATCH'
]
)
app
.
register_blueprint
(
service_api_bp
)
CORS
(
web_bp
,
...
...
api/controllers/service_api/app/conversation.py
View file @
16424d42
# -*- coding:utf-8 -*-
from
flask
import
request
from
flask_restful
import
fields
,
marshal_with
,
reqparse
from
flask_restful.inputs
import
int_range
from
werkzeug.exceptions
import
NotFound
...
...
@@ -56,12 +57,10 @@ class ConversationDetailApi(AppApiResource):
conversation_id
=
str
(
c_id
)
parser
=
reqparse
.
RequestParser
()
parser
.
add_argument
(
'user'
,
type
=
str
,
location
=
'args'
)
args
=
parser
.
parse_args
()
user
=
request
.
get_json
()
.
get
(
'user'
)
if
end_user
is
None
and
args
[
'user'
]
is
not
None
:
end_user
=
create_or_update_end_user_for_user_id
(
app_model
,
args
[
'user'
]
)
if
end_user
is
None
and
user
is
not
None
:
end_user
=
create_or_update_end_user_for_user_id
(
app_model
,
user
)
try
:
ConversationService
.
delete
(
app_model
,
conversation_id
,
end_user
)
...
...
@@ -95,3 +94,4 @@ class ConversationRenameApi(AppApiResource):
api
.
add_resource
(
ConversationRenameApi
,
'/conversations/<uuid:c_id>/name'
,
endpoint
=
'conversation_name'
)
api
.
add_resource
(
ConversationApi
,
'/conversations'
)
api
.
add_resource
(
ConversationApi
,
'/conversations/<uuid:c_id>'
,
endpoint
=
'conversation'
)
api
.
add_resource
(
ConversationDetailApi
,
'/conversations/<uuid:c_id>'
,
endpoint
=
'conversation_detail'
)
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