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.5 kB

3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // 上传文件1: 获取文件chunks信息
  45. // params: { md5, type: 0-CPU/GPU,1-NPU, file_name, scene: 'model', modeluuid }
  46. // return: uploadID, uuid, uploaded, chunks, attachID, modeluuid, modelName, fileName
  47. export const getChunks = (params) => {
  48. return service({
  49. url: `/attachments/get_chunks`,
  50. method: 'get',
  51. params,
  52. data: {},
  53. });
  54. };
  55. // 上传文件2: 上传新文件
  56. // params: { totalChunkCounts, md5, size, fileType, type, file_name, scene=model, modeluuid=xxxx }
  57. // return: uploadID, uuid
  58. export const getNewMultipart = (params) => {
  59. return service({
  60. url: `/attachments/new_multipart`,
  61. method: 'get',
  62. params,
  63. data: {},
  64. });
  65. };
  66. // 上传文件3: 获取分片上传地址
  67. // params: { uuid, uploadID, size, chunkNumber, type, file_name, scene=model }
  68. // return: url
  69. export const getMultipartUrl = (params) => {
  70. return service({
  71. url: `/attachments/get_multipart_url`,
  72. method: 'get',
  73. params,
  74. data: {},
  75. });
  76. };
  77. // 上传文件4: 完成上传后
  78. // data: { uuid, uploadID, size, type, file_name, dataset_id, description, scene=model, modeluuid=xxxx }
  79. export const setCompleteMultipart = (data) => {
  80. return service({
  81. url: `/attachments/complete_multipart`,
  82. method: 'post',
  83. headers: { 'Content-type': 'application/x-www-form-urlencoded' },
  84. params: {},
  85. data: Qs.stringify(data),
  86. });
  87. };