# stargraph **Repository Path**: senchien/stargraph ## Basic Information - **Project Name**: stargraph - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-19 - **Last Updated**: 2026-01-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 根据提供的代码结构,我来为这个项目生成README文档: # StarGraph ## 项目简介 StarGraph 是一个基于 Spring Boot 的 AI 图像生成服务平台,整合了 Comfyui 和 Ollama 技术,提供文本到图像(Text-to-Image)的生成服务。该系统支持用户认证、积分管理、任务队列调度以及 WebSocket 实时状态推送等功能。 ## 技术栈 - **后端框架**: Spring Boot - **数据库**: MySQL + MyBatis-Plus - **缓存/消息队列**: Redis + Redisson - **AI 集成**: Comfyui(图像生成)、Ollama(大语言模型) - **WebSocket**: STOMP 协议实时通信 - **模板引擎**: Freemarker - **安全认证**: JWT ## 核心模块 ### 1. 图像生成服务(Comfyui) - **客户端**: ComfyuiApi、ComfyuiConfig、ComfyuiMessageHandler - **功能**: - 文本到图像转换 - 支持多种采样器(sampler)和调度器(scheduler) - 可配置的生成参数(步数、CFG、种子值等) - 实时任务状态追踪 ### 2. 大语言模型服务(Ollama) - **客户端**: OllamaApi、OllamaConfig - **功能**: - 文本翻译 - 提示词优化 - 支持流式响应 ### 3. 用户服务 - **认证**: 用户登录(用户名/密码) - **积分管理**: - 积分冻结/扣减/返还 - 资金记录追踪 - **VIP 等级**: 用户会员级别管理 ### 4. 任务调度系统 - **分布式任务队列**: 基于 Redis 实现 - **自动执行**: 定时任务 RunTaskJob - **状态追踪**: 实时 WebSocket 推送 ## 项目结构 ``` src/main/java/cn/itcast/star/graph/ ├── StarGraphApp.java # 启动类 ├── comfyui/ # Comfyui 客户端 │ ├── client/ │ │ ├── api/ComfyuiApi.java # API 接口 │ │ ├── config/ComfyuiConfig.java # 配置类 │ │ ├── handler/ComfyuiMessageHandler.java # WebSocket 消息处理 │ │ └── pojo/ # 数据对象 │ │ ├── ComfyuiModel.java │ │ ├── ComfyuiRequestDto.java │ │ ├── ComfyuiTask.java │ │ └── ... ├── core/ # 核心业务模块 │ ├── config/ # 配置类 │ │ ├── MybatisPlusConfig.java │ │ ├── RedissionConfig.java │ │ ├── WebMvcConfig.java │ │ └── WebsocketConfig.java │ ├── controller/ │ │ ├── TextToImageController.java │ │ └── UserController.java │ ├── dto/ # 数据传输对象 │ ├── interceptor/ # 拦截器 │ ├── job/RunTaskJob.java # 任务调度 │ ├── mapper/ # MyBatis 映射器 │ ├── pojo/ # 实体类 │ │ ├── User.java │ │ ├── UserFund.java │ │ ├── UserResult.java │ │ └── UserFundRecord.java │ └── service/ # 服务层 │ ├── impl/ │ │ ├── Text2ImageServiceImpl.java │ │ ├── UserServiceImpl.java │ │ └── ... │ └── ... └── ollama/ # Ollama 客户端 ├── client/ │ ├── api/OllamaApi.java │ ├── config/OllamaConfig.java │ └── pojo/ # 数据对象 ``` ## API 接口 ### 用户接口 - `POST /api/1.0/user/login` - 用户登录 ### 图像生成接口 - `POST /api/authed/1.0/t2i/propmt` - 提交文本到图像生成任务 ## WebSocket 端点 - **连接端点**: STOMP over WebSocket - **主题**: - `/topic/queue` - 队列状态推送 - `/user/queue/msg` - 用户消息推送 ## 数据库表 | 表名 | 说明 | |------|------| | sg_user | 用户信息表 | | sg_user_fund | 用户积分表 | | sg_user_fund_record | 积分变动记录表 | | sg_user_result | 用户生成结果表 | ## 快速开始 ### 环境要求 - JDK 17+ - MySQL 8.0+ - Redis 6.0+ - Comfyui 服务 - Ollama 服务 ### 配置说明 在 `application.yml` 中配置以下关键参数: ```yaml server: port: 8080 spring: datasource: url: jdbc:mysql://localhost:3306/stargraph driver-class-name: com.mysql.cj.jdbc.Driver redis: host: localhost port: 6379 comfyui: server-url: http://localhost:8188 ollama: server-url: http://localhost:11434 ``` ### 运行步骤 1. 克隆项目: ```bash git clone https://gitee.com/senchien/stargraph.git ``` 2. 创建数据库并导入表结构 3. 修改配置文件中的数据库和 Redis 连接信息 4. 启动服务: ```bash mvn spring-boot:run ``` ## 许可证 本项目基于 [许可证名称] 开源授权。 ## 贡献者 感谢所有为这个项目做出贡献的开发者!