mirror of
https://gh-proxy.org/https://github.com/klinsmaya/new-api.git
synced 2026-11-08 01:17:09 +08:00
Add the synchronous openai_image host protocol so a task plugin can claim POST /v1/images/generations and /v1/images/edits; the host submits the task, polls it inside the request and lets the plugin render the OpenAI image response. Unclaimed models still fall back to the HTTP image relay. - Migrate Ali (Bailian) image models to the alibaba plugin and remove the ali channel image/wan adaptors and the qwen model setting - Add Doubao Seedream image generation to the doubao plugin - Support retainResult on routes and indexed multipart file references - Settle image counts from upstream usage or image payloads; document the rule in the billing conventions and plugin API docs - Show billing source and task artifacts in usage logs; rename the DoubaoVideo channel display name to Doubao and refresh the favicon
34 lines
773 B
Go
34 lines
773 B
Go
package router
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
"testing"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestHostProtocolRegistryDrivesProtocolRoutesOnce(t *testing.T) {
|
|
engine := gin.New()
|
|
SetTaskPluginProtocolRouter(engine)
|
|
|
|
expected := []string{
|
|
"POST /v1/responses",
|
|
"GET /v1/responses/:response_id",
|
|
"POST /v1/videos",
|
|
"GET /v1/videos/:task_id",
|
|
"GET /v1/videos/:task_id/content",
|
|
"HEAD /v1/videos/:task_id/content",
|
|
"POST /v1/images/generations",
|
|
"POST /v1/images/edits",
|
|
}
|
|
actual := make([]string, 0, len(engine.Routes()))
|
|
for _, route := range engine.Routes() {
|
|
actual = append(actual, fmt.Sprintf("%s %s", route.Method, route.Path))
|
|
}
|
|
sort.Strings(expected)
|
|
sort.Strings(actual)
|
|
assert.Equal(t, expected, actual)
|
|
}
|