Skip to content

Commit

Permalink
Merge pull request #16 from lingmengcan/dev
Browse files Browse the repository at this point in the history
1.0.0
  • Loading branch information
lingmengcan authored Sep 11, 2024
2 parents a1f2cce + 398430d commit 47bd0d6
Show file tree
Hide file tree
Showing 50 changed files with 1,772 additions and 686 deletions.
44 changes: 22 additions & 22 deletions service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lingmengcan-service",
"version": "0.9.9.20240801",
"version": "1.0.0.20240911",
"description": "lingmengcan-ai",
"author": "lingmengcan",
"private": true,
Expand All @@ -20,36 +20,36 @@
"genorm": "rm -rf entities-template & npx typeorm-model-generator -h localhost -d lingmengcan -p 3306 -u root -x 123456 -e mysql -o entities-template --noConfig true --ce pascal --cp camel"
},
"dependencies": {
"@langchain/community": "^0.2.18",
"@langchain/core": "^0.2.15",
"@langchain/openai": "^0.2.1",
"@nestjs/common": "^10.3.10",
"@langchain/community": "^0.2.31",
"@langchain/core": "^0.2.28",
"@langchain/openai": "^0.2.7",
"@nestjs/common": "^10.4.1",
"@nestjs/config": "^3.2.3",
"@nestjs/core": "^10.3.10",
"@nestjs/core": "^10.4.1",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.10",
"@nestjs/platform-express": "^10.4.1",
"@nestjs/serve-static": "^4.0.2",
"@nestjs/swagger": "^7.4.0",
"@nestjs/typeorm": "^10.0.2",
"@types/node-fetch": "^2.6.11",
"axios": "^1.7.2",
"axios": "^1.7.5",
"bcrypt": "^5.1.1",
"chromadb": "^1.8.1",
"class-validator": "^0.14.1",
"dayjs": "^1.11.11",
"dayjs": "^1.11.13",
"express-session": "^1.18.0",
"https-proxy-agent": "^7.0.5",
"js-yaml": "^4.1.0",
"langchain": "^0.2.9",
"langchain": "^0.2.17",
"mammoth": "^1.8.0",
"multer": "1.4.5-lts.1",
"mysql2": "^3.10.2",
"mysql2": "^3.11.0",
"node-fetch": "^3.3.2",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"pdf-parse": "^1.1.1",
"qs": "^6.12.3",
"qs": "^6.13.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"stream": "^0.0.2",
Expand All @@ -58,33 +58,33 @@
"uuid": "^10.0.0"
},
"devDependencies": {
"@nestjs/cli": "^10.4.2",
"@nestjs/schematics": "^10.1.2",
"@nestjs/testing": "^10.3.10",
"@nestjs/cli": "^10.4.4",
"@nestjs/schematics": "^10.1.4",
"@nestjs/testing": "^10.4.1",
"@types/bcrypt": "^5.0.2",
"@types/express": "^4.17.21",
"@types/express-session": "^1.18.0",
"@types/jest": "^29.5.12",
"@types/multer": "^1.4.11",
"@types/node": "^20.14.10",
"@types/multer": "^1.4.12",
"@types/node": "^20.16.1",
"@types/passport-jwt": "^4.0.1",
"@types/qs": "^6.9.15",
"@types/supertest": "^6.0.2",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.2",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
},
"jest": {
"moduleFileExtensions": [
Expand Down
10 changes: 5 additions & 5 deletions service/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('AppController', () => {
appController = app.get<AppController>(AppController);
});

describe('root', () => {
it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
});
});
// describe('root', () => {
// it('should return "Hello World!"', () => {
// expect(appController.getHello()).toBe('Hello World!');
// });
// });
});
2 changes: 2 additions & 0 deletions service/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DictModule } from './modules/dict.module';
import { FileModule } from './modules/file.module';
import { ModelModule } from './modules/model.module';
import { MediaModule } from './modules/media.module';
import { DrawModule } from './modules/draw.module';

@Module({
imports: [
Expand Down Expand Up @@ -48,6 +49,7 @@ import { MediaModule } from './modules/media.module';
FileModule,
ModelModule,
MediaModule,
DrawModule,
],
controllers: [AppController],
providers: [AppService],
Expand Down
20 changes: 19 additions & 1 deletion service/src/controllers/draw.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import { Body, Controller, Request, Post, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiTags } from '@nestjs/swagger';
import { MediaListDto, Txt2ImgDto } from '../dtos/draw.dto';
import { ControlNetPreprocessorService } from '@/services/control-net-preprocessor.service';

@UseGuards(AuthGuard('jwt'))
@ApiTags('draw') // 添加 接口标签 装饰器
@Controller('draw')
export class DrawController {
constructor(private readonly mediaService: MediaService) {}
constructor(
private readonly mediaService: MediaService,
private readonly controlNetPreprocessorService: ControlNetPreprocessorService,
) {}

/**
* 文生图
Expand Down Expand Up @@ -39,4 +43,18 @@ export class DrawController {

return successJson(res);
}

/**
* 获取全部control net 预处理器
*
* @param dto
* @returns
*/
@UseGuards(AuthGuard('jwt'))
@Post('control-net-preprocessor-list')
async getPreprocessorList() {
const res = await this.controlNetPreprocessorService.findPreprocessorList();

return successJson(res);
}
}
51 changes: 51 additions & 0 deletions service/src/entities/control-net-preprocessor.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { IsNotEmpty } from 'class-validator';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('control_net_preprocessor')
export class ControlNetPreprocessor {
@PrimaryGeneratedColumn({ type: 'bigint', name: 'preprocessor_id', unsigned: true })
preprocessorId: number;

@Column('varchar', { name: 'preprocessor_name', length: 100 })
preprocessorName: string;

@Column('varchar', { name: 'preprocessor_code', length: 100 })
preprocessorCode: string;

@Column('varchar', { name: 'preprocessor_type', length: 100 })
preprocessorType: string;

@Column({ type: 'json', name: 'params' })
params: string;

@Column('int', { name: 'sort' })
sort: number;

@Column('tinyint', {
name: 'status',
comment: '-1 deleted, 0 normal, 1 deactivated',
})
@IsNotEmpty()
status: number;

@Column('varchar', { name: 'description', length: 512 })
description: string;

@Column('varchar', { name: 'created_user', length: 32 })
createdUser: string;

@Column('varchar', { name: 'updated_user', length: 32 })
updatedUser: string;

@Column('datetime', {
name: 'created_at',
default: () => 'CURRENT_TIMESTAMP',
})
createdAt: Date;

@Column('datetime', {
name: 'updated_at',
default: () => 'CURRENT_TIMESTAMP',
})
updatedAt: Date;
}
6 changes: 3 additions & 3 deletions service/src/entities/dict.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export class Dict {
@PrimaryGeneratedColumn({ type: 'bigint', name: 'dict_id', unsigned: true })
dictId: string;

@Column('varchar', { name: 'dict_name', length: 32 })
@Column('varchar', { name: 'dict_name', length: 100 })
dictName: string;

@Column('varchar', { name: 'dict_code', length: 32 })
@Column('varchar', { name: 'dict_code', length: 100 })
dictCode: string;

@Column('varchar', { name: 'dict_type', length: 32 })
@Column('varchar', { name: 'dict_type', length: 100 })
dictType: string;

@Column('int', { name: 'sort' })
Expand Down
11 changes: 11 additions & 0 deletions service/src/modules/control-net-preprocessor.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ControlNetPreprocessor } from '@/entities/control-net-preprocessor.entity';
import { ControlNetPreprocessorService } from '@/services/control-net-preprocessor.service';
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';

@Module({
imports: [TypeOrmModule.forFeature([ControlNetPreprocessor])],
providers: [ControlNetPreprocessorService],
exports: [ControlNetPreprocessorService],
})
export class ControlNetPreprocessorModule {}
13 changes: 13 additions & 0 deletions service/src/modules/draw.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { DrawController } from '@/controllers/draw.controller';
import { DrawService } from '@/services/draw.service';
import { Module } from '@nestjs/common';
import { MediaModule } from './media.module';
import { ControlNetPreprocessorModule } from './control-net-preprocessor.module';

@Module({
imports: [MediaModule, ControlNetPreprocessorModule],
controllers: [DrawController],
providers: [DrawService],
exports: [DrawService],
})
export class DrawModule {}
2 changes: 0 additions & 2 deletions service/src/modules/media.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DrawController } from '@/controllers/draw.controller';
import { Media } from '@/entities/media.entity';
import { MediaService } from '@/services/media.service';
import { Module } from '@nestjs/common';
Expand All @@ -17,7 +16,6 @@ import { join } from 'path';
}),
TypeOrmModule.forFeature([Media]),
],
controllers: [DrawController],
providers: [MediaService],
exports: [MediaService],
})
Expand Down
28 changes: 28 additions & 0 deletions service/src/services/control-net-preprocessor.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ControlNetPreprocessor } from '@/entities/control-net-preprocessor.entity';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { DataSource, Repository } from 'typeorm';

@Injectable()
export class ControlNetPreprocessorService {
constructor(
@InjectRepository(ControlNetPreprocessor)
private repository: Repository<ControlNetPreprocessor>,
private dataSource: DataSource,
) {}

/**
* 列表
*
* @returns
*/
async findPreprocessorList() {
const qb = this.repository
.createQueryBuilder('ControlNetPreprocessor')
.andWhere('ControlNetPreprocessor.status = 0');

qb.orderBy({ 'ControlNetPreprocessor.sort': 'ASC' });

return qb.getMany();
}
}
4 changes: 4 additions & 0 deletions service/src/services/draw.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class DrawService {}
42 changes: 21 additions & 21 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lingmengcan-web",
"version": "0.9.9.20240801",
"version": "1.0.0.20240911",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -16,51 +16,51 @@
"@traptitech/markdown-it-katex": "^3.6.0",
"@vicons/antd": "^0.12.0",
"@vicons/ionicons5": "^0.12.0",
"@vueuse/core": "^10.11.0",
"axios": "^1.7.2",
"dayjs": "^1.11.12",
"@vueuse/core": "^10.11.1",
"axios": "^1.7.5",
"dayjs": "^1.11.13",
"highlight.js": "^11.10.0",
"js-cookie": "^3.0.5",
"markdown-it": "^14.1.0",
"masonry-layout": "^4.2.2",
"naive-ui": "^2.39.0",
"pinia": "^2.1.7",
"qs": "^6.12.3",
"vue": "^3.4.33",
"vue-i18n": "^9.13.1",
"pinia": "^2.2.2",
"qs": "^6.13.0",
"vue": "^3.4.38",
"vue-i18n": "^9.14.0",
"vue-masonry": "^0.16.0",
"vue-router": "^4.4.0"
"vue-router": "^4.4.3"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
"@tailwindcss/typography": "^0.5.14",
"@tsconfig/node18": "^18.2.4",
"@types/markdown-it": "^14.1.1",
"@types/markdown-it": "^14.1.2",
"@types/markdown-it-link-attributes": "^3.0.5",
"@types/node": "^20.14.12",
"@types/node": "^20.16.1",
"@types/qs": "^6.9.15",
"@vitejs/plugin-vue": "^5.1.0",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.19",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-define-config": "^2.1.0",
"eslint-plugin-vue": "^9.27.0",
"less": "^4.2.0",
"less-loader": "^12.2.0",
"markdown-it-link-attributes": "^4.0.1",
"npm-run-all2": "^6.2.2",
"postcss": "^8.4.39",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"stylelint": "^16.7.0",
"stylelint": "^16.8.2",
"stylelint-config-recommended": "^14.0.1",
"stylelint-config-recommended-less": "^3.0.1",
"tailwindcss": "^3.4.6",
"tailwindcss": "^3.4.10",
"typescript": "~5.5.4",
"unplugin-auto-import": "^0.17.8",
"unplugin-vue-components": "^0.27.3",
"vite": "^5.3.4",
"vue-tsc": "^2.0.28"
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.2",
"vue-tsc": "^2.0.29"
}
}
Loading

0 comments on commit 47bd0d6

Please sign in to comment.