voice.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import request from '@/utils/request/req';
  2. export interface RoleReq {
  3. name:string; // 角色名称
  4. description:string; //角色描述
  5. prompt:string;//音频地址
  6. avatar: string; //头像地址
  7. }
  8. export interface SimpleGenerate {
  9. model: string,
  10. randomness: number,
  11. stability_boost: number,
  12. voiceId: string,
  13. text: string
  14. }
  15. export interface Character {
  16. id: string;
  17. name: string;
  18. description: string;
  19. voicesId: string;
  20. avatar: string;
  21. previewAudio: string;
  22. }
  23. export function createRole(params:RoleReq) {
  24. return request({
  25. url: '/system/voice/add',
  26. method: 'post',
  27. data: params,
  28. })
  29. }
  30. export function simpleGenerateReq(params:SimpleGenerate) {
  31. return request({
  32. url: '/system/voice/simpleGenerate',
  33. method: 'post',
  34. data: params,
  35. })
  36. }
  37. export function delRole(id:string) {
  38. return request({
  39. url: '/system/voice/'+ id,
  40. method: 'delete',
  41. })
  42. }
  43. export function getRole() {
  44. return request({
  45. url: '/system/voice/list',
  46. method: 'get',
  47. })
  48. }
  49. /**
  50. * 获取声音市场角色
  51. *
  52. * @returns 市场角色
  53. *
  54. */
  55. export function getRoleList() {
  56. return request({
  57. url: '/system/voice/roleList',
  58. method: 'get'
  59. })
  60. }
  61. /**
  62. * 收藏声音市场角色
  63. *
  64. */
  65. export function copyRoleList(item: any) {
  66. return request({
  67. url: '/system/voice/copyRole',
  68. method: 'post',
  69. data: item
  70. })
  71. }