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
2c74048f
authored
Oct 28, 2025
by
Seefs
Committed by
GitHub
Oct 28, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2102 from Sh1n3zZ/feat-sora-vertex-adaptor
feat: vertex veo sora-compatible video output
parents
68afbba3
0dee8685
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
relay/channel/task/vertex/adaptor.go
+24
-0
relay/relay_task.go
+17
-12
No files found.
relay/channel/task/vertex/adaptor.go
View file @
2c74048f
...
...
@@ -10,6 +10,7 @@ import (
"regexp"
"strings"
"github.com/QuantumNous/new-api/common"
"github.com/QuantumNous/new-api/model"
"github.com/gin-gonic/gin"
...
...
@@ -302,6 +303,29 @@ func (a *TaskAdaptor) ParseTaskResult(respBody []byte) (*relaycommon.TaskInfo, e
return
ti
,
nil
}
func
(
a
*
TaskAdaptor
)
ConvertToOpenAIVideo
(
task
*
model
.
Task
)
([]
byte
,
error
)
{
upstreamName
,
err
:=
decodeLocalTaskID
(
task
.
TaskID
)
if
err
!=
nil
{
upstreamName
=
""
}
modelName
:=
extractModelFromOperationName
(
upstreamName
)
if
strings
.
TrimSpace
(
modelName
)
==
""
{
modelName
=
"veo-3.0-generate-001"
}
v
:=
dto
.
NewOpenAIVideo
()
v
.
ID
=
task
.
TaskID
v
.
Model
=
modelName
v
.
Status
=
task
.
Status
.
ToVideoStatus
()
v
.
SetProgressStr
(
task
.
Progress
)
v
.
CreatedAt
=
task
.
CreatedAt
v
.
CompletedAt
=
task
.
UpdatedAt
if
strings
.
HasPrefix
(
task
.
FailReason
,
"data:"
)
&&
len
(
task
.
FailReason
)
>
0
{
v
.
SetMetadata
(
"url"
,
task
.
FailReason
)
}
return
common
.
Marshal
(
v
)
}
// ============================
// helpers
// ============================
...
...
relay/relay_task.go
View file @
2c74048f
...
...
@@ -351,7 +351,10 @@ func videoFetchByIDRespBodyBuilder(c *gin.Context) (respBody []byte, taskResp *d
originTask
.
Progress
=
ti
.
Progress
}
if
ti
.
Url
!=
""
{
originTask
.
FailReason
=
ti
.
Url
if
strings
.
HasPrefix
(
ti
.
Url
,
"data:"
)
{
}
else
{
originTask
.
FailReason
=
ti
.
Url
}
}
_
=
originTask
.
Update
()
var
raw
map
[
string
]
any
...
...
@@ -379,18 +382,20 @@ func videoFetchByIDRespBodyBuilder(c *gin.Context) (respBody []byte, taskResp *d
case
model
.
TaskStatusQueued
,
model
.
TaskStatusSubmitted
:
status
=
"queued"
}
out
:=
map
[
string
]
any
{
"error"
:
nil
,
"format"
:
format
,
"metadata"
:
nil
,
"status"
:
status
,
"task_id"
:
originTask
.
TaskID
,
"url"
:
originTask
.
FailReason
,
if
!
strings
.
HasPrefix
(
c
.
Request
.
RequestURI
,
"/v1/videos/"
)
{
out
:=
map
[
string
]
any
{
"error"
:
nil
,
"format"
:
format
,
"metadata"
:
nil
,
"status"
:
status
,
"task_id"
:
originTask
.
TaskID
,
"url"
:
originTask
.
FailReason
,
}
respBody
,
_
=
json
.
Marshal
(
dto
.
TaskResponse
[
any
]{
Code
:
"success"
,
Data
:
out
,
})
}
respBody
,
_
=
json
.
Marshal
(
dto
.
TaskResponse
[
any
]{
Code
:
"success"
,
Data
:
out
,
})
}
}()
...
...
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