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 2.8 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. // 求模型信息
  25. export const getModelInfoByName = (params) => {
  26. return service({
  27. url: `${params.repo}/modelmanage/show_model_info_api`,
  28. method: 'get',
  29. params,
  30. data: {},
  31. });
  32. };
  33. // 求模型中文件列表
  34. // params {repo, ID, parentDir}
  35. export const getModelFiles = (params) => {
  36. return service({
  37. url: `${params.repo}/modelmanage/query_onelevel_modelfile`,
  38. method: 'get',
  39. params,
  40. data: {},
  41. });
  42. };
  43. // 删除模型文件
  44. // params {repo, id, fileName}
  45. export const deleteModelFile = (params) => {
  46. return service({
  47. url: `${params.repo}/modelmanage/delete_model_file`,
  48. method: 'delete',
  49. params,
  50. data: {},
  51. });
  52. };
  53. /* 文件上传相关 */
  54. // 上传文件1: 获取文件chunks信息
  55. // params: { md5, type: 0-CPU/GPU,1-NPU, file_name, scene: 'model', modeluuid }
  56. // return: uploadID, uuid, uploaded, chunks, attachID, modeluuid, modelName, fileName
  57. export const getChunks = (params) => {
  58. return service({
  59. url: `/attachments/model/get_chunks`,
  60. method: 'get',
  61. params,
  62. data: {},
  63. });
  64. };
  65. // 上传文件2: 上传新文件
  66. // params: { totalChunkCounts, md5, size, fileType, type, file_name, scene=model, modeluuid=xxxx }
  67. // return: uploadID, uuid
  68. export const getNewMultipart = (params) => {
  69. return service({
  70. url: `/attachments/model/new_multipart`,
  71. method: 'get',
  72. params,
  73. data: {},
  74. });
  75. };
  76. // 上传文件3: 获取分片上传地址
  77. // params: { uuid, uploadID, size, chunkNumber, type, file_name, scene=model }
  78. // return: url
  79. export const getMultipartUrl = (params) => {
  80. return service({
  81. url: `/attachments/model/get_multipart_url`,
  82. method: 'get',
  83. params,
  84. data: {},
  85. });
  86. };
  87. // 上传文件4: 完成上传后
  88. // data: { uuid, uploadID, size, type, file_name, dataset_id, description, scene=model, modeluuid=xxxx }
  89. export const setCompleteMultipart = (data) => {
  90. return service({
  91. url: `/attachments/model/complete_multipart`,
  92. method: 'post',
  93. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  94. params: {},
  95. data: Qs.stringify(data),
  96. });
  97. };