Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4db3aebb
authored
Sep 12, 2025
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: jimeng video add images
parent
e55c84f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
relay/channel/task/jimeng/adaptor.go
+4
-4
relay/common/relay_info.go
+3
-2
relay/common/relay_utils.go
+7
-2
No files found.
relay/channel/task/jimeng/adaptor.go
View file @
4db3aebb
...
@@ -318,11 +318,11 @@ func (a *TaskAdaptor) convertToRequestPayload(req *relaycommon.TaskSubmitReq) (*
...
@@ -318,11 +318,11 @@ func (a *TaskAdaptor) convertToRequestPayload(req *relaycommon.TaskSubmitReq) (*
}
}
// Handle one-of image_urls or binary_data_base64
// Handle one-of image_urls or binary_data_base64
if
req
.
Image
!=
""
{
if
req
.
HasImage
()
{
if
strings
.
HasPrefix
(
req
.
Image
,
"http"
)
{
if
strings
.
HasPrefix
(
req
.
Image
s
[
0
]
,
"http"
)
{
r
.
ImageUrls
=
[]
string
{
req
.
Image
}
r
.
ImageUrls
=
req
.
Images
}
else
{
}
else
{
r
.
BinaryDataBase64
=
[]
string
{
req
.
Image
}
r
.
BinaryDataBase64
=
req
.
Images
}
}
}
}
metadata
:=
req
.
Metadata
metadata
:=
req
.
Metadata
...
...
relay/common/relay_info.go
View file @
4db3aebb
...
@@ -481,6 +481,7 @@ type TaskSubmitReq struct {
...
@@ -481,6 +481,7 @@ type TaskSubmitReq struct {
Model
string
`json:"model,omitempty"`
Model
string
`json:"model,omitempty"`
Mode
string
`json:"mode,omitempty"`
Mode
string
`json:"mode,omitempty"`
Image
string
`json:"image,omitempty"`
Image
string
`json:"image,omitempty"`
Images
[]
string
`json:"images,omitempty"`
Size
string
`json:"size,omitempty"`
Size
string
`json:"size,omitempty"`
Duration
int
`json:"duration,omitempty"`
Duration
int
`json:"duration,omitempty"`
Metadata
map
[
string
]
interface
{}
`json:"metadata,omitempty"`
Metadata
map
[
string
]
interface
{}
`json:"metadata,omitempty"`
...
@@ -490,8 +491,8 @@ func (t TaskSubmitReq) GetPrompt() string {
...
@@ -490,8 +491,8 @@ func (t TaskSubmitReq) GetPrompt() string {
return
t
.
Prompt
return
t
.
Prompt
}
}
func
(
t
TaskSubmitReq
)
GetImage
()
string
{
func
(
t
TaskSubmitReq
)
HasImage
()
bool
{
return
t
.
Image
return
len
(
t
.
Images
)
>
0
}
}
type
TaskInfo
struct
{
type
TaskInfo
struct
{
...
...
relay/common/relay_utils.go
View file @
4db3aebb
...
@@ -16,7 +16,7 @@ type HasPrompt interface {
...
@@ -16,7 +16,7 @@ type HasPrompt interface {
}
}
type
HasImage
interface
{
type
HasImage
interface
{
GetImage
()
string
HasImage
()
bool
}
}
func
GetFullRequestURL
(
baseURL
string
,
requestURL
string
,
channelType
int
)
string
{
func
GetFullRequestURL
(
baseURL
string
,
requestURL
string
,
channelType
int
)
string
{
...
@@ -74,6 +74,11 @@ func ValidateBasicTaskRequest(c *gin.Context, info *RelayInfo, action string) *d
...
@@ -74,6 +74,11 @@ func ValidateBasicTaskRequest(c *gin.Context, info *RelayInfo, action string) *d
return
taskErr
return
taskErr
}
}
if
len
(
req
.
Images
)
==
0
&&
strings
.
TrimSpace
(
req
.
Image
)
!=
""
{
// 兼容单图上传
req
.
Images
=
[]
string
{
req
.
Image
}
}
storeTaskRequest
(
c
,
info
,
action
,
req
)
storeTaskRequest
(
c
,
info
,
action
,
req
)
return
nil
return
nil
}
}
...
@@ -89,7 +94,7 @@ func ValidateTaskRequestWithImage(c *gin.Context, info *RelayInfo, requestObj in
...
@@ -89,7 +94,7 @@ func ValidateTaskRequestWithImage(c *gin.Context, info *RelayInfo, requestObj in
}
}
action
:=
constant
.
TaskActionTextGenerate
action
:=
constant
.
TaskActionTextGenerate
if
hasImage
,
ok
:=
requestObj
.
(
HasImage
);
ok
&&
strings
.
TrimSpace
(
hasImage
.
GetImage
())
!=
""
{
if
hasImage
,
ok
:=
requestObj
.
(
HasImage
);
ok
&&
hasImage
.
HasImage
()
{
action
=
constant
.
TaskActionGenerate
action
=
constant
.
TaskActionGenerate
}
}
...
...
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