Skip to content

Commit 9cdfe93

Browse files
authored
Merge pull request #28 from DEEIX-AI/image_edit
feat: support OpenAI, Google, xAI Image Edits protocol
2 parents b93051f + b73a2e0 commit 9cdfe93

82 files changed

Lines changed: 2960 additions & 490 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ The architecture is designed for simple deployment, efficient static delivery, a
3434
| Area | Capabilities |
3535
| --- | --- |
3636
| Conversations | Multi-branch chat, streaming, retries, edits, feedback, sharing, cloned shared conversations, rich markdown rendering, file cards, model metadata, usage details, and execution traces. |
37-
| Media generation | Dedicated image generation and image edit flow with task-aware routing, OpenAI Images-compatible protocols, generated file storage, preview, download, and run history separated from text chat. |
37+
| Media generation | Dedicated image generation and image edit flow with task-aware routing, provider-native OpenAI, Google, and xAI image protocols, generated file storage, preview, download, and run history separated from text chat. |
3838
| Model control plane | Platform model catalog, upstream channels, real upstream models, route bindings, priority and weight routing, model capability JSON, display ordering, vendor mapping, automatic icons, and circuit breaker state. |
39-
| Provider protocols | OpenAI Responses and Chat Completions, OpenAI Images, Anthropic Messages, Google/Gemini Generate Content, xAI Responses, OpenRouter defaults, and custom OpenAI-compatible routes. |
39+
| Provider protocols | OpenAI Responses, Chat Completions, Images Generations, and Images Edits; Anthropic Messages; Google/Gemini Generate Content and Image Generation; xAI Responses, Images Generations, and Images Edits; OpenRouter defaults; and custom OpenAI-compatible routes. |
4040
| Request governance | Protocol-aware request assembly, user option allowlists and denylists, system-protected fields, previous-response continuation where supported, and context snapshots for review. |
4141
| Files and RAG | File upload, preview, download, deletion, quota control, MIME detection, text extraction, OCR, full-context injection, image context, chunking, embeddings, and semantic retrieval. |
4242
| Memory and context | Message-window truncation, token-budget truncation, context compression, conversation memory, long-term user memory, RAG evidence records, and prompt trace inspection. |

README.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ DEEIX Chat 为团队提供统一的 AI 工作台,用一个清晰的使用入
3434
| 模块 | 能力 |
3535
| --- | --- |
3636
| 对话体验 | 多分支会话、流式响应、重试、编辑、反馈、公开分享、克隆分享会话、富文本 Markdown、文件卡片、模型元信息、用量明细和执行链路。 |
37-
| 媒体生成 | 独立的图片生成和图片编辑链路,按任务类型路由到 OpenAI Images 兼容协议,生成结果统一入库为文件,支持预览、下载和独立运行记录。 |
37+
| 媒体生成 | 独立的图片生成和图片编辑链路,按任务类型路由到 OpenAI、Google 和 xAI 的原生图片协议,生成结果统一入库为文件,支持预览、下载和独立运行记录。 |
3838
| 模型控制面 | 平台模型目录、上游渠道、真实上游模型、路由绑定、优先级/权重路由、能力 JSON、展示顺序、厂商映射、自动图标和熔断状态。 |
39-
| 协议适配 | OpenAI ResponsesChat Completions、OpenAI ImagesAnthropic MessagesGoogle/Gemini Generate ContentxAI Responses、OpenRouter 默认协议和自定义 OpenAI 兼容路由。 |
39+
| 协议适配 | OpenAI ResponsesChat Completions、Images Generations 和 Images Edits,Anthropic MessagesGoogle/Gemini Generate Content 和 Image Generation,xAI Responses、Images Generations 和 Images Edits,OpenRouter 默认协议和自定义 OpenAI 兼容路由。 |
4040
| 请求治理 | 按协议组装上游请求,支持用户参数白名单/黑名单、系统保护字段、协议支持时的 previous response 续接,以及可回看的上下文快照。 |
4141
| 文件与 RAG | 文件上传、预览、下载、删除、配额控制、MIME 探测、文本提取、OCR、全文上下文注入、图片上下文、分片、向量嵌入和语义检索。 |
4242
| 记忆与上下文 | 消息数截断、Token 预算截断、上下文压缩、会话记忆、用户长期记忆、RAG 证据记录和提示词链路查看。 |

backend/cmd/server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
// @title DEEIX Chat API
12-
// @version 0.1.0
12+
// @version 0.1.1
1313
// @description DEEIX Chat 后端 API 文档
1414
// @BasePath /api/v1
1515
// @securityDefinitions.apikey BearerAuth

backend/docs/docs.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9049,6 +9049,12 @@ const docTemplate = `{
90499049
"type": "string",
90509050
"maxLength": 64
90519051
},
9052+
"protocols": {
9053+
"type": "array",
9054+
"items": {
9055+
"type": "string"
9056+
}
9057+
},
90529058
"status": {
90539059
"type": "string",
90549060
"enum": [
@@ -9075,12 +9081,24 @@ const docTemplate = `{
90759081
"createdRoute": {
90769082
"type": "boolean"
90779083
},
9084+
"createdRoutes": {
9085+
"type": "integer"
9086+
},
90789087
"error": {
90799088
"type": "string"
90809089
},
9090+
"existingRoutes": {
9091+
"type": "integer"
9092+
},
90819093
"platformModelName": {
90829094
"type": "string"
90839095
},
9096+
"protocols": {
9097+
"type": "array",
9098+
"items": {
9099+
"type": "string"
9100+
}
9101+
},
90849102
"status": {
90859103
"type": "string"
90869104
},
@@ -9908,6 +9926,12 @@ const docTemplate = `{
99089926
"suggestedProtocol": {
99099927
"type": "string"
99109928
},
9929+
"suggestedProtocols": {
9930+
"type": "array",
9931+
"items": {
9932+
"type": "string"
9933+
}
9934+
},
99119935
"upstreamModelName": {
99129936
"type": "string"
99139937
},
@@ -11647,7 +11671,7 @@ const docTemplate = `{
1164711671

1164811672
// SwaggerInfo holds exported Swagger Info so clients can modify it
1164911673
var SwaggerInfo = &swag.Spec{
11650-
Version: "0.1.0",
11674+
Version: "0.1.1",
1165111675
Host: "",
1165211676
BasePath: "/api/v1",
1165311677
Schemes: []string{},

backend/docs/swagger.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "DEEIX Chat 后端 API 文档",
55
"title": "DEEIX Chat API",
66
"contact": {},
7-
"version": "0.1.0"
7+
"version": "0.1.1"
88
},
99
"basePath": "/api/v1",
1010
"paths": {
@@ -9042,6 +9042,12 @@
90429042
"type": "string",
90439043
"maxLength": 64
90449044
},
9045+
"protocols": {
9046+
"type": "array",
9047+
"items": {
9048+
"type": "string"
9049+
}
9050+
},
90459051
"status": {
90469052
"type": "string",
90479053
"enum": [
@@ -9068,12 +9074,24 @@
90689074
"createdRoute": {
90699075
"type": "boolean"
90709076
},
9077+
"createdRoutes": {
9078+
"type": "integer"
9079+
},
90719080
"error": {
90729081
"type": "string"
90739082
},
9083+
"existingRoutes": {
9084+
"type": "integer"
9085+
},
90749086
"platformModelName": {
90759087
"type": "string"
90769088
},
9089+
"protocols": {
9090+
"type": "array",
9091+
"items": {
9092+
"type": "string"
9093+
}
9094+
},
90779095
"status": {
90789096
"type": "string"
90799097
},
@@ -9901,6 +9919,12 @@
99019919
"suggestedProtocol": {
99029920
"type": "string"
99039921
},
9922+
"suggestedProtocols": {
9923+
"type": "array",
9924+
"items": {
9925+
"type": "string"
9926+
}
9927+
},
99049928
"upstreamModelName": {
99059929
"type": "string"
99069930
},

backend/docs/swagger.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,10 @@ definitions:
16491649
protocol:
16501650
maxLength: 64
16511651
type: string
1652+
protocols:
1653+
items:
1654+
type: string
1655+
type: array
16521656
status:
16531657
enum:
16541658
- active
@@ -1670,10 +1674,18 @@ definitions:
16701674
type: boolean
16711675
createdRoute:
16721676
type: boolean
1677+
createdRoutes:
1678+
type: integer
16731679
error:
16741680
type: string
1681+
existingRoutes:
1682+
type: integer
16751683
platformModelName:
16761684
type: string
1685+
protocols:
1686+
items:
1687+
type: string
1688+
type: array
16771689
status:
16781690
type: string
16791691
upstreamModelName:
@@ -2226,6 +2238,10 @@ definitions:
22262238
type: string
22272239
suggestedProtocol:
22282240
type: string
2241+
suggestedProtocols:
2242+
items:
2243+
type: string
2244+
type: array
22292245
upstreamModelName:
22302246
type: string
22312247
upstreamModelStatus:
@@ -3371,7 +3387,7 @@ info:
33713387
contact: {}
33723388
description: DEEIX Chat 后端 API 文档
33733389
title: DEEIX Chat API
3374-
version: 0.1.0
3390+
version: 0.1.1
33753391
paths:
33763392
/admin/audit-logs:
33773393
get:

backend/internal/application/channel/dto.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type UpstreamRemoteModelView struct {
4040
SuggestedPlatformModelName string
4141
SuggestedKindsJSON string
4242
SuggestedProtocol string
43+
SuggestedProtocols []string
4344
BindingCode string
4445
BoundPlatformModels []string
4546
UpstreamModelStatus string
@@ -85,6 +86,9 @@ type ImportUpstreamModelResultView struct {
8586
BindingCode string
8687
Status string
8788
CreatedRoute bool
89+
CreatedRoutes int
90+
ExistingRoutes int
91+
Protocols []string
8892
CreatedPlatform bool
8993
Error string
9094
}

backend/internal/application/channel/errs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ var (
4141
ErrInvalidModelOrder = errors.New("invalid model order")
4242
// ErrProtocolRequired 无法通过瀑布规则推断协议。
4343
ErrProtocolRequired = errors.New("protocol required")
44+
// ErrInvalidRouteProtocolCombination 路由协议组合无效。
45+
ErrInvalidRouteProtocolCombination = errors.New("invalid route protocol combination")
4446
// ErrUpstreamModelNotFound 上游模型路由绑定不存在。
4547
ErrUpstreamModelNotFound = repository.ErrUpstreamModelNotFound
4648
// ErrUpstreamModelConflict 上游模型路由绑定冲突。

backend/internal/application/channel/input.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ type ImportUpstreamModelItemInput struct {
9797
PlatformModelName string
9898
UpstreamModelName string
9999
Protocol string
100+
Protocols []string
100101
KindsJSON string
101102
Status string
102103
Priority int

0 commit comments

Comments
 (0)