You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

modelmanage.js 3.0 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import service from "../service";
  2. import Qs from 'qs';
  3. // 保存本地模型
  4. export const saveLocalModel = (data) => {
  5. return service({
  6. url: `${data.repo}/modelmanage/create_local_model`,
  7. method: 'post',
  8. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  9. params: {},
  10. data: Qs.stringify(data),
  11. });
  12. };
  13. // 修改模型
  14. // data: {id,type,name,version,engine,label,description:}
  15. export const modifyModel = (data) => {
  16. return service({
  17. url: `${data.repo}/modelmanage/modify_model`,
  18. method: 'put',
  19. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  20. params: {},
  21. data: Qs.stringify(data),
  22. });
  23. };
  24. export const modifyModelStatus = (data) => {
  25. return service({
  26. url: `${data.repo}/modelmanage/modify_model_status`,
  27. method: 'put',
  28. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  29. params: {},
  30. data: Qs.stringify(data),
  31. });
  32. };
  33. // 求模型信息
  34. export const getModelInfoByName = (params) => {
  35. return service({
  36. url: `${params.repo}/modelmanage/show_model_info_api`,
  37. method: 'get',
  38. params,
  39. data: {},
  40. });
  41. };
  42. // 求模型中文件列表
  43. // params {repo, ID, parentDir}
  44. export const getModelFiles = (params) => {
  45. return service({
  46. url: `${params.repo}/modelmanage/query_onelevel_modelfile`,
  47. method: 'get',
  48. params,
  49. data: {},
  50. });
  51. };
  52. // 删除模型文件
  53. // params {repo, id, fileName}
  54. export const deleteModelFile = (params) => {
  55. return service({
  56. url: `${params.repo}/modelmanage/delete_model_file`,
  57. method: 'delete',
  58. params,
  59. data: {},
  60. });
  61. };
  62. /* 文件上传相关 */
  63. // 上传文件1: 获取文件chunks信息
  64. // params: { md5, type: 0-CPU/GPU,1-NPU, file_name, scene: 'model', modeluuid }
  65. // return: uploadID, uuid, uploaded, chunks, attachID, modeluuid, modelName, fileName
  66. export const getChunks = (params) => {
  67. return service({
  68. url: `/attachments/model/get_chunks`,
  69. method: 'get',
  70. params,
  71. data: {},
  72. });
  73. };
  74. // 上传文件2: 上传新文件
  75. // params: { totalChunkCounts, md5, size, fileType, type, file_name, scene=model, modeluuid=xxxx }
  76. // return: uploadID, uuid
  77. export const getNewMultipart = (params) => {
  78. return service({
  79. url: `/attachments/model/new_multipart`,
  80. method: 'get',
  81. params,
  82. data: {},
  83. });
  84. };
  85. // 上传文件3: 获取分片上传地址
  86. // params: { uuid, uploadID, size, chunkNumber, type, file_name, scene=model }
  87. // return: url
  88. export const getMultipartUrl = (params) => {
  89. return service({
  90. url: `/attachments/model/get_multipart_url`,
  91. method: 'get',
  92. params,
  93. data: {},
  94. });
  95. };
  96. // 上传文件4: 完成上传后
  97. // data: { uuid, uploadID, size, type, file_name, dataset_id, description, scene=model, modeluuid=xxxx }
  98. export const setCompleteMultipart = (data) => {
  99. return service({
  100. url: `/attachments/model/complete_multipart`,
  101. method: 'post',
  102. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  103. params: {},
  104. data: Qs.stringify(data),
  105. });
  106. };