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
d733803c
authored
Oct 11, 2025
by
feitianbubu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: kling create video via openai sdk
parent
d724f25d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
relay/channel/task/jimeng/adaptor.go
+0
-1
relay/channel/task/kling/adaptor.go
+14
-14
No files found.
relay/channel/task/jimeng/adaptor.go
View file @
d733803c
...
...
@@ -163,7 +163,6 @@ func (a *TaskAdaptor) DoResponse(c *gin.Context, resp *http.Response, info *rela
ov
.
TaskID
=
jResp
.
Data
.
TaskID
ov
.
CreatedAt
=
time
.
Now
()
.
Unix
()
ov
.
Model
=
info
.
OriginModelName
ov
.
Metadata
=
map
[
string
]
any
{}
c
.
JSON
(
http
.
StatusOK
,
ov
)
return
jResp
.
Data
.
TaskID
,
responseBody
,
nil
}
...
...
relay/channel/task/kling/adaptor.go
View file @
d733803c
...
...
@@ -6,13 +6,11 @@ import (
"fmt"
"io"
"net/http"
"strconv"
"strings"
"time"
"github.com/QuantumNous/new-api/model"
"github.com/bytedance/gopkg/util/logger"
"github.com/samber/lo"
"github.com/gin-gonic/gin"
...
...
@@ -190,8 +188,12 @@ func (a *TaskAdaptor) DoResponse(c *gin.Context, resp *http.Response, info *rela
taskErr
=
service
.
TaskErrorWrapperLocal
(
fmt
.
Errorf
(
kResp
.
Message
),
"task_failed"
,
http
.
StatusBadRequest
)
return
}
kResp
.
TaskId
=
kResp
.
Data
.
TaskId
c
.
JSON
(
http
.
StatusOK
,
kResp
)
ov
:=
relaycommon
.
NewOpenAIVideo
()
ov
.
ID
=
kResp
.
Data
.
TaskId
ov
.
TaskID
=
kResp
.
Data
.
TaskId
ov
.
CreatedAt
=
time
.
Now
()
.
Unix
()
ov
.
Model
=
info
.
OriginModelName
c
.
JSON
(
http
.
StatusOK
,
ov
)
return
kResp
.
Data
.
TaskId
,
responseBody
,
nil
}
...
...
@@ -370,20 +372,18 @@ func (a *TaskAdaptor) ConvertToOpenAIVideo(originTask *model.Task) (*relaycommon
if
err
:=
json
.
Unmarshal
(
originTask
.
Data
,
&
klingResp
);
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"unmarshal kling task data failed"
)
}
openAIVideo
:=
&
relaycommon
.
OpenAIVideo
{
ID
:
klingResp
.
Data
.
TaskId
,
Object
:
"video"
,
//Model: "kling-v1", //todo save model
Status
:
string
(
originTask
.
Status
),
CreatedAt
:
klingResp
.
Data
.
CreatedAt
,
CompletedAt
:
klingResp
.
Data
.
UpdatedAt
,
Metadata
:
make
(
map
[
string
]
any
),
}
openAIVideo
:=
relaycommon
.
NewOpenAIVideo
()
openAIVideo
.
ID
=
originTask
.
TaskID
openAIVideo
.
Status
=
originTask
.
Status
.
ToVideoStatus
()
openAIVideo
.
SetProgressStr
(
originTask
.
Progress
)
openAIVideo
.
CreatedAt
=
klingResp
.
Data
.
CreatedAt
openAIVideo
.
CompletedAt
=
klingResp
.
Data
.
UpdatedAt
if
len
(
klingResp
.
Data
.
TaskResult
.
Videos
)
>
0
{
video
:=
klingResp
.
Data
.
TaskResult
.
Videos
[
0
]
if
video
.
Url
!=
""
{
openAIVideo
.
Metadata
[
"url"
]
=
video
.
Url
openAIVideo
.
SetMetadata
(
"url"
,
video
.
Url
)
}
if
video
.
Duration
!=
""
{
openAIVideo
.
Seconds
=
video
.
Duration
...
...
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