1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-15 03:10:13 +00:00

Support ai instruction ()

* support ai instruction

* update

* update

---------

Co-authored-by: zheng.shen <zheng.shen@seafile.com>
This commit is contained in:
shenzheng-1 2025-03-13 17:31:16 +08:00 committed by GitHub
parent d4af41cbce
commit 796d2c3144
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -324,15 +324,17 @@ class WritingAssistant(APIView):
text = request.data.get('text')
writing_type = request.data.get('writing_type')
custom_prompt = request.data.get('custom_prompt')
if not text:
return api_error(status.HTTP_400_BAD_REQUEST, 'text invalid')
if not writing_type:
if not custom_prompt and not writing_type:
return api_error(status.HTTP_400_BAD_REQUEST, 'writing_type invalid')
params = {
'text': text,
'writing_type': writing_type,
'custom_prompt': custom_prompt,
}
try: