Skip to content

Commit d5753aa

Browse files
committed
feat(draw): 增加绘画模块,支持gpt-image系列模型,包括图像编辑、区域编辑等等
1 parent 379635f commit d5753aa

53 files changed

Lines changed: 3905 additions & 39 deletions

Some content is hidden

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

src-tauri/Cargo.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ tempfile = "3"
7171
open = "5"
7272
urlencoding = "2"
7373
dirs = "5"
74+
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] }
7475

7576
[target.'cfg(target_vendor = "apple")'.dependencies]
7677
objc2 = { version = "0.6", features = ["relax-sign-encoding"] }

src-tauri/crates/core/src/db.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ pub fn get_builtin_providers() -> Vec<BuiltinProvider> {
9292
vec![TextChat, Vision, FunctionCalling],
9393
Some(1047576),
9494
),
95+
("gpt-image-2", "gpt-image-2", vec![], None),
96+
("gpt-image-1.5", "gpt-image-1.5", vec![], None),
97+
("gpt-image-1", "gpt-image-1", vec![], None),
98+
("gpt-image-1-mini", "gpt-image-1-mini", vec![], None),
9599
],
96100
},
97101
BuiltinProvider {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use sea_orm::entity::prelude::*;
2+
use serde::{Deserialize, Serialize};
3+
4+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
5+
#[sea_orm(table_name = "drawing_generations")]
6+
pub struct Model {
7+
#[sea_orm(primary_key, auto_increment = false)]
8+
pub id: String,
9+
pub parent_generation_id: Option<String>,
10+
pub provider_id: String,
11+
pub key_id: String,
12+
pub model_id: String,
13+
pub api_kind: String,
14+
pub action: String,
15+
pub prompt: String,
16+
pub parameters_json: String,
17+
pub reference_file_ids_json: String,
18+
pub source_image_ids_json: String,
19+
pub mask_file_id: Option<String>,
20+
pub status: String,
21+
pub error_message: Option<String>,
22+
pub response_id: Option<String>,
23+
pub usage_json: Option<String>,
24+
pub created_at: i64,
25+
pub completed_at: Option<i64>,
26+
}
27+
28+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
29+
pub enum Relation {}
30+
31+
impl ActiveModelBehavior for ActiveModel {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use sea_orm::entity::prelude::*;
2+
use serde::{Deserialize, Serialize};
3+
4+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
5+
#[sea_orm(table_name = "drawing_images")]
6+
pub struct Model {
7+
#[sea_orm(primary_key, auto_increment = false)]
8+
pub id: String,
9+
pub generation_id: String,
10+
pub stored_file_id: String,
11+
pub storage_path: String,
12+
pub mime_type: String,
13+
pub width: Option<i32>,
14+
pub height: Option<i32>,
15+
pub revised_prompt: Option<String>,
16+
pub created_at: i64,
17+
}
18+
19+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
20+
pub enum Relation {}
21+
22+
impl ActiveModelBehavior for ActiveModel {}

src-tauri/crates/core/src/entity/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pub mod conversation_categories;
44
pub mod conversation_summaries;
55
pub mod conversations;
66
pub mod desktop_state;
7+
pub mod drawing_generations;
8+
pub mod drawing_images;
79
pub mod gateway_diagnostics;
810
pub mod gateway_keys;
911
pub mod gateway_request_logs;

src-tauri/crates/core/src/repo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub mod context_source;
55
pub mod conversation;
66
pub mod conversation_branch;
77
pub mod conversation_category;
8+
pub mod drawing;
89
pub mod gateway;
910
pub mod gateway_diagnostic;
1011
pub mod gateway_key;

0 commit comments

Comments
 (0)