Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
open_ai_api
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
open_ai_api
Commits
4291cb0c
Commit
4291cb0c
authored
Apr 11, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
9b2c7c26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
app/Service/TaskService.php
+3
-3
No files found.
app/Service/TaskService.php
View file @
4291cb0c
...
@@ -19,7 +19,7 @@ public function submit($user_id, array $data = [])
...
@@ -19,7 +19,7 @@ public function submit($user_id, array $data = [])
# task表新增一条记录
# task表新增一条记录
$type
=
$data
[
'type'
]
??
''
;
$type
=
$data
[
'type'
]
??
''
;
$prompt
=
$data
[
'prompt'
]
??
''
;
$prompt
=
$data
[
'prompt'
]
??
''
;
$prompt_img
=
$data
[
'prompt_img'
];
$prompt_img
=
$data
[
'prompt_img'
]
??
[]
;
$prompt_num
=
$data
[
'prompt_num'
]
??
''
;
$prompt_num
=
$data
[
'prompt_num'
]
??
''
;
if
(
empty
(
$type
)
||
empty
(
$prompt
))
{
if
(
empty
(
$type
)
||
empty
(
$prompt
))
{
throw
new
UserException
(
'任务类型不能为空'
);
throw
new
UserException
(
'任务类型不能为空'
);
...
@@ -32,7 +32,7 @@ public function submit($user_id, array $data = [])
...
@@ -32,7 +32,7 @@ public function submit($user_id, array $data = [])
# 判断类型
# 判断类型
if
(
$type
==
self
::
TYPE_IMG_TO_IMG
)
{
if
(
$type
==
self
::
TYPE_IMG_TO_IMG
)
{
# 图片转图片
# 图片转图片
if
(
empty
(
$prompt_img
))
{
if
(
!
count
(
$prompt_img
))
{
throw
new
UserException
(
'图片不能为空'
);
throw
new
UserException
(
'图片不能为空'
);
}
}
}
elseif
(
$type
==
self
::
TYPE_TEXT_TO_IMG
)
{
}
elseif
(
$type
==
self
::
TYPE_TEXT_TO_IMG
)
{
...
@@ -82,7 +82,7 @@ public function gpt_callback($data = [])
...
@@ -82,7 +82,7 @@ public function gpt_callback($data = [])
$user_id
=
$credentials
[
'user_id'
];
$user_id
=
$credentials
[
'user_id'
];
$task_id
=
$credentials
[
'task_id'
];
$task_id
=
$credentials
[
'task_id'
];
# 可选字段
# 可选字段
$prompt_img
=
$credentials
[
'prompt_img'
]
??
null
;
$prompt_img
=
$credentials
[
'prompt_img'
]
??
''
;
$result_img
=
$credentials
[
'result_img'
]
??
''
;
$result_img
=
$credentials
[
'result_img'
]
??
''
;
# 判断必须字段
# 判断必须字段
if
(
empty
(
$type
)
||
empty
(
$prompt
)
||
empty
(
$user_id
)
||
empty
(
$task_id
))
{
if
(
empty
(
$type
)
||
empty
(
$prompt
)
||
empty
(
$user_id
)
||
empty
(
$task_id
))
{
...
...
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