imagine.service.d.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import { HttpClient } from '@angular/common/http';
  2. import { NovaCloudService } from '../../../nova-cloud/nova-cloud.service';
  3. import Parse from "parse";
  4. import { NovaUploadService } from '../../../storage/service-upload/nova-upload.service';
  5. import { DalleOptions } from './imagine-func';
  6. import * as i0 from "@angular/core";
  7. export interface StableDiffusionOptions {
  8. prompt: string;
  9. modelStyleId: number;
  10. negativePrompt?: string;
  11. width?: number;
  12. height?: number;
  13. steps?: number;
  14. seed?: number;
  15. cfgScale?: number;
  16. hrScale?: number;
  17. hrSteps?: number;
  18. upscale?: number;
  19. batchSize?: number;
  20. faceFix?: boolean;
  21. detailsLevel?: number;
  22. img?: string;
  23. imgOptions?: imgOptions;
  24. denoisingStrength?: number;
  25. controlnet?: {
  26. units?: ControlnetUnits[];
  27. };
  28. }
  29. /**
  30. * imgOptions 图像配置参数
  31. * @public
  32. */
  33. export interface imgOptions {
  34. removeBackground?: boolean;
  35. redrawBackground?: boolean;
  36. mainObjectType?: "human" | "general";
  37. facePreservation?: boolean;
  38. facePreservationCount?: number;
  39. genderDetect?: boolean;
  40. }
  41. /**
  42. * ControlnetUnits 控制网络单元
  43. * @public
  44. */
  45. export interface ControlnetUnits {
  46. isOpen?: boolean;
  47. type?: string;
  48. preprocess?: boolean;
  49. image?: string;
  50. controlMode?: number;
  51. weight?: number;
  52. controlStart?: number;
  53. controlEnd?: number;
  54. paramsA?: number;
  55. paramsB?: number;
  56. controlArray?: any[];
  57. }
  58. /**
  59. * ImagineService AI绘画服务
  60. */
  61. export declare class ImagineService {
  62. private http;
  63. private ncloud;
  64. private uploadServ;
  65. /**
  66. * 图片生成接口主机地址
  67. */
  68. constructor(http: HttpClient, ncloud: NovaCloudService, uploadServ: NovaUploadService);
  69. /**
  70. * DALL-E-3 图片生成函数
  71. * @description
  72. * @see
  73. * https://p4.hosteagle.club/docs/api-reference?__cpo=aHR0cHM6Ly9wbGF0Zm9ybS5vcGVuYWkuY29t
  74. * @returns
  75. * {
  76. "id": "lpJGiFwWeA", // 图片生成任务ID
  77. "createdAt": "2024-11-27T12:18:14.463Z"
  78. }
  79. * @param {DalleOptions} options
  80. * @param {string} options.prompt 1000 characters for dall-e-2 and 4000 characters for dall-e-3.
  81. * @param {string} options.model dall-e-3 dall-e-2
  82. * @param {string} options.quality dall-e-3 only hd means more details & consistency
  83. * @param {string} options.response_format url | b64_json
  84. * @param {string} options.size 1024x1024, 1792x1024, or 1024x1792 for dall-e-3
  85. * @param {string} options.style vivid | natural dall-e-3 only
  86. */
  87. drawDalle(options: DalleOptions): Promise<Parse.Object<Parse.Attributes>>;
  88. priceDalle(options: DalleOptions): any;
  89. priceStableDiffusion(options: StableDiffusionOptions): number;
  90. b64DataToBase64Image(b64_json: any): void;
  91. /**
  92. * Huashi6专用绘图函数
  93. * @param reqBody
  94. * @see
  95. * 接口reqBody参数,参考:https://www.showdoc.com.cn/2307900595645609/10319675987319598
  96. * 密码:123456
  97. * @returns
  98. */
  99. draw(reqBody: any): Promise<any>;
  100. /**
  101. * 已完成的直接加载,未完成的再接口更新
  102. * @param taskId
  103. * @returns
  104. */
  105. taskDetail(taskId: string): Promise<any>;
  106. taskDetailMap: any;
  107. /**
  108. * 我的绘画作品共享方法
  109. */
  110. newWorkList: Array<Parse.Object>;
  111. myWorkList: Array<Parse.Object>;
  112. getMyWorkQuery(): Parse.Query<Parse.Object<Parse.Attributes>>;
  113. getWorkQuery(): Parse.Query<Parse.Object<Parse.Attributes>>;
  114. getimg(): Promise<string>;
  115. static ɵfac: i0.ɵɵFactoryDeclaration<ImagineService, never>;
  116. static ɵprov: i0.ɵɵInjectableDeclaration<ImagineService>;
  117. }