Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6fb98f5
feat(spx-gui):init painter
petezhuang Aug 11, 2025
6d9238e
feat(spx-gui):basic infrastructure of painter
petezhuang Aug 11, 2025
b04690e
feat(spx-gui):Decoupling the painter board and draw line components
petezhuang Aug 11, 2025
6cd49ff
fix(spx-gui):fix wrong start point initial position while drawing line
petezhuang Aug 12, 2025
15d80da
fix(painter):fix select tool handle bug
AvenJi0320 Aug 12, 2025
55dfe7c
fix:(spx-gui):wrong preview layer layout
petezhuang Aug 12, 2025
897ae2c
feat(painter):add paint brush tool
AvenJi0320 Aug 12, 2025
1846368
fix(painter):modify brush bug
AvenJi0320 Aug 12, 2025
be7572b
fix(painter):fix select btn css
AvenJi0320 Aug 13, 2025
970b99d
feat(spx-gui):painter aigc function init
petezhuang Aug 13, 2025
0229c71
feat(spx-gui):img and svg aigc function init(mock edt) and several bu…
petezhuang Aug 13, 2025
04165af
feat(spx-gui):add modify privew & change img save func
AvenJi0320 Aug 13, 2025
d352e46
fix(painter):fix control dot display
AvenJi0320 Aug 13, 2025
cf0f1aa
feat(spx-gui):(in developing)ai generate png and svg function(backend…
petezhuang Aug 13, 2025
7bab162
feat(spx-gui):english support for picgc and add error modal
petezhuang Aug 14, 2025
61e6820
fix(spx-gui):wrong aigc model closing logic
petezhuang Aug 14, 2025
2abc810
fix(painter):fix painter editor flash & privew item flash
AvenJi0320 Aug 14, 2025
a8a9ee6
feat(spx-gui):init code splitting
petezhuang Aug 14, 2025
71afa18
fix(spx-gui):migrate image and svg loading function
petezhuang Aug 15, 2025
7601097
fix(spx-gui):migrate and decouple ai generate pic and svg function
petezhuang Aug 15, 2025
df7ceab
refactor(painter):extract reshape tool into standalone component
AvenJi0320 Aug 15, 2025
12e1938
feat(painter): add 5 placeholder tools with improved layout
AvenJi0320 Aug 15, 2025
a4d704a
feat(spx-gui):select different text to svg provider and several bug fixs
petezhuang Aug 15, 2025
fe368dd
refactor(spx-gui):init allpath interface
petezhuang Aug 20, 2025
e2be904
fix(spx-gui):wrong interface export method
petezhuang Aug 20, 2025
d435f57
refactor(spx-gui):move importSvgToCanvas method out of painter component
AvenJi0320 Aug 20, 2025
bbd8937
refactor(spx-gui): move loadimage function out of painter component
AvenJi0320 Aug 21, 2025
9b3b17e
refactor(spx-gui):Rewrite export function into useSvgExporter and dec…
petezhuang Aug 21, 2025
2d3abb0
feat(spx-backend):add health
freshspf Aug 20, 2025
5ac9451
feat(spx-backend):add svg-service to spx-backend
thewindwillstop Aug 21, 2025
6d62842
feat(spx-backend):add translate
thewindwillstop Aug 21, 2025
6fcf64d
Synchronization
Aug 21, 2025
82e7948
rename: spx-recommend -> spx-algorithm
Aug 21, 2025
2ef5406
refactor(spx-gui):decouple draw_line module
petezhuang Aug 21, 2025
415c0c0
docs:add svg-service to apidoc
freshspf Aug 21, 2025
8cc303c
refactor(spx-gui):event delegator
petezhuang Aug 22, 2025
3ef7066
refactor(spx-gui): refact the import & export to the manager
AvenJi0320 Aug 22, 2025
4ed9aba
feat: add network image URL support with proper SVG handling
Aug 22, 2025
bcc74f4
Fix: fix function search_with_urls_example
Aug 22, 2025
ccbb1a5
docs(spx-backend): add documatation for database design
thewindwillstop Aug 22, 2025
50ca86b
refactor(spx-gui):decoupling all tool components
petezhuang Aug 25, 2025
a6144a7
docs(spx-gui): add aigc-design doc
AvenJi0320 Aug 25, 2025
168895b
docs(spx-gui): add english aigc-design version doc
AvenJi0320 Aug 25, 2025
a32a7f0
docs(spx-backend):add theme model doc
thewindwillstop Aug 25, 2025
896567a
refactor(spx-gui):Change AIGC interaction API
petezhuang Aug 26, 2025
e27180f
doc: add document of clip
Aug 26, 2025
744fd3d
doc: add document of test theme classifiation
Aug 26, 2025
2624a6c
Merge pull request #64 from petezhuang/feature/theme
thewindwillstop Aug 26, 2025
454f13f
feature:add theme prompt
thewindwillstop Aug 26, 2025
aaa112e
feature: add svg database to current project
Aug 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 269 additions & 0 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,146 @@ paths:
schema:
$ref: "#/components/schemas/AIInteractionResponse"

/image:
post:
tags:
- AI-SVG
summary: AI generate images
description: |
Generate AI-powered images and return image metadata including URLs, dimensions, and generation details.

Supports multiple AI providers (svgio, recraft, openai) with automatic prompt translation.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/GenerateImageParams"
responses:
"200":
description: Successfully generated image and returned metadata.
content:
application/json:
schema:
$ref: "#/components/schemas/ImageResponse"
"400":
description: Invalid request parameters.
content:
application/json:
schema:
type: object
properties:
error:
type: string
examples:
- "prompt must be at least 3 characters"
- "provider must be one of: svgio, recraft, openai"
"500":
description: Internal server error during image generation.
content:
application/json:
schema:
type: object
properties:
error:
type: string
examples:
- "failed to generate image"

/image/svg:
post:
tags:
- AI-SVG
summary: Generate SVG image directly
description: |
Generate AI-powered SVG images and return the SVG file content directly in the response body.

Returns actual SVG content instead of metadata, with generation details provided in response headers.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/GenerateImageParams"
responses:
"200":
description: Successfully generated SVG image.
headers:
Content-Type:
description: MIME type of the response
schema:
type: string
example: "image/svg+xml"
Content-Disposition:
description: File download information
schema:
type: string
example: 'attachment; filename="img_abc123.svg"'
X-Image-Id:
description: Unique identifier for the generated image
schema:
type: string
example: "img_abc123"
X-Image-Width:
description: Width of the generated image in pixels
schema:
type: integer
example: 512
X-Image-Height:
description: Height of the generated image in pixels
schema:
type: integer
example: 512
X-Provider:
description: AI provider used for generation
schema:
type: string
example: "svgio"
X-Original-Prompt:
description: Original prompt provided by user (if available)
schema:
type: string
example: "A beautiful sunset over mountains"
X-Translated-Prompt:
description: Translated version of prompt (if translation was applied)
schema:
type: string
example: "A beautiful sunset over mountains"
X-Was-Translated:
description: Whether the prompt was automatically translated
schema:
type: string
example: "false"
content:
image/svg+xml:
schema:
type: string
format: binary
description: The generated SVG image content
"400":
description: Invalid request parameters.
content:
application/json:
schema:
type: object
properties:
error:
type: string
examples:
- "prompt must be at least 3 characters"
- "provider must be one of: svgio, recraft, openai"
"500":
description: Internal server error during image generation.
content:
application/json:
schema:
type: object
properties:
error:
type: string
examples:
- "failed to generate SVG"

/course:
post:
tags:
Expand Down Expand Up @@ -1979,6 +2119,135 @@ components:
examples:
- 0

GenerateImageParams:
type: object
required:
- prompt
properties:
prompt:
type: string
minLength: 3
description: The text prompt for image generation
examples:
- "A beautiful sunset over mountains"
negative_prompt:
type: string
description: Text describing what should not appear in the image
examples:
- "blurry, low quality"
style:
type: string
description: Style of the generated image
examples:
- "cartoon"
- "realistic"
- "sketch"
provider:
type: string
enum:
- svgio
- recraft
- openai
default: svgio
description: The AI provider to use for generation
examples:
- "svgio"
format:
type: string
description: Output format of the generated image
examples:
- "svg"
- "png"
skip_translate:
type: boolean
default: false
description: Whether to skip automatic prompt translation
model:
type: string
description: Specific model to use for generation
examples:
- "gpt-4"
size:
type: string
description: Size of the generated image
examples:
- "512x512"
- "1024x1024"
substyle:
type: string
description: Sub-style variant for the image
examples:
- "hand-drawn"
n:
type: integer
minimum: 1
description: Number of images to generate
examples:
- 1

ImageResponse:
type: object
properties:
id:
type: string
description: Unique identifier for the generated image
examples:
- "img_abc123"
svg_url:
type: string
format: uri
description: URL to access the generated SVG image
examples:
- "https://example.com/images/img_abc123.svg"
png_url:
type: string
format: uri
description: URL to access the PNG version of the image (if available)
examples:
- "https://example.com/images/img_abc123.png"
width:
type: integer
minimum: 1
description: Width of the generated image in pixels
examples:
- 512
height:
type: integer
minimum: 1
description: Height of the generated image in pixels
examples:
- 512
provider:
type: string
enum:
- svgio
- recraft
- openai
description: The AI provider used for generation
examples:
- "svgio"
original_prompt:
type: string
description: The original prompt provided by the user
examples:
- "A beautiful sunset over mountains"
translated_prompt:
type: string
description: The translated version of the prompt (if translation was applied)
examples:
- "A beautiful sunset over mountains"
was_translated:
type: boolean
description: Whether the prompt was automatically translated
examples:
- false
created_at:
type: string
format: date-time
description: Timestamp when the image was generated
examples:
- "2024-01-15T10:30:00Z"

AIInteractionResponse:
type: object
properties:
Expand Down
96 changes: 96 additions & 0 deletions spx-algorithm/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Image Search API 客户端

这个目录包含了调用Image Search API的客户端示例代码。

## 文件说明

- `image_search_client.py` - 完整的客户端类,包含所有API调用功能
- `simple_client.py` - 简单的API调用示例
- `README.md` - 本说明文件

## 使用方法

### 1. 安装依赖

```bash
pip install requests
```

### 2. 启动API服务

首先确保API服务正在运行:

```bash
cd ../project
python run.py
```

### 3. 运行客户端

#### 使用完整客户端类:

```bash
python image_search_client.py
```

#### 使用简单示例:

```bash
python simple_client.py
```

## API调用示例

### 文件上传搜索

```python
import requests

url = "http://localhost:5000/api/search"
files = [
('images', open('image1.jpg', 'rb')),
('images', open('image2.png', 'rb')),
]
data = {
'text': 'a cute cat',
'top_k': 3
}

response = requests.post(url, files=files, data=data)
result = response.json()
```

### URL搜索

```python
import requests

url = "http://localhost:5000/api/search/url"
data = {
"text": "beautiful landscape",
"image_urls": [
"https://example.com/image1.jpg",
"https://example.com/image2.png"
],
"top_k": 5
}

response = requests.post(url, json=data)
result = response.json()
```

### 健康检查

```python
import requests

response = requests.get("http://localhost:5000/api/health")
health = response.json()
```

## 注意事项

1. 确保API服务正在运行(默认端口5000)
2. 文件搜索需要提供实际存在的图片文件路径
3. URL搜索需要提供可访问的图片URL
4. 所有API调用都应该包含适当的错误处理
Loading