ollama.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import request from '@repo/api-client'
  4. /** 批量检查模型是否可用 POST /api/ai/ollama/checkModels */
  5. export async function postAiOllamaCheckModels(
  6. body: {
  7. models: string[]
  8. },
  9. options?: { [key: string]: any }
  10. ) {
  11. return request<{
  12. isSuccess: boolean
  13. code: number
  14. result: { available?: boolean; name?: string }[]
  15. isAuthorized: boolean
  16. }>('/api/ai/ollama/checkModels', {
  17. method: 'POST',
  18. headers: {
  19. 'Content-Type': 'application/json'
  20. },
  21. data: body,
  22. ...(options || {})
  23. })
  24. }
  25. /** 下载模型 POST /api/ai/ollama/downloadModel */
  26. export async function postAiOllamaDownloadModel(
  27. body: {
  28. model: string
  29. },
  30. options?: { [key: string]: any }
  31. ) {
  32. return request<{
  33. isSuccess: boolean
  34. code: number
  35. result: { modelName: string; progress: number; status: string; taskId: string }
  36. isAuthorized: boolean
  37. }>('/api/ai/ollama/downloadModel', {
  38. method: 'POST',
  39. headers: {
  40. 'Content-Type': 'application/json'
  41. },
  42. data: body,
  43. ...(options || {})
  44. })
  45. }
  46. /** 获取下载进度 POST /api/ai/ollama/downloadProcess */
  47. export async function postAiOllamaDownloadProcess(
  48. body: {
  49. taskId: string
  50. },
  51. options?: { [key: string]: any }
  52. ) {
  53. return request<{
  54. isSuccess: boolean
  55. code: number
  56. result: {
  57. id: string
  58. message: string
  59. modelName: string
  60. progress: number
  61. startTime: string
  62. status: string
  63. }
  64. isAuthorized: boolean
  65. }>('/api/ai/ollama/downloadProcess', {
  66. method: 'POST',
  67. headers: {
  68. 'Content-Type': 'application/json'
  69. },
  70. data: body,
  71. ...(options || {})
  72. })
  73. }
  74. /** 获取所有下载任务列表 POST /api/ai/ollama/downloadTasks */
  75. export async function postAiOllamaDownloadTasks(body: {}, options?: { [key: string]: any }) {
  76. return request<{
  77. isSuccess: boolean
  78. code: number
  79. result: {
  80. id?: string
  81. message?: string
  82. modelName?: string
  83. progress?: number
  84. startTime?: string
  85. status?: string
  86. }[]
  87. isAuthorized: boolean
  88. }>('/api/ai/ollama/downloadTasks', {
  89. method: 'POST',
  90. headers: {
  91. 'Content-Type': 'application/json'
  92. },
  93. data: body,
  94. ...(options || {})
  95. })
  96. }
  97. /** 获取模型列表 POST /api/ai/ollama/models */
  98. export async function postAiOllamaModels(body: {}, options?: { [key: string]: any }) {
  99. return request<{
  100. isSuccess: boolean
  101. code: number
  102. result: { digest?: string; modified_at?: string; name?: string; size?: number }[]
  103. isAuthorized: boolean
  104. }>('/api/ai/ollama/models', {
  105. method: 'POST',
  106. headers: {
  107. 'Content-Type': 'application/json'
  108. },
  109. data: body,
  110. ...(options || {})
  111. })
  112. }
  113. /** 检查Ollama状态 POST /api/ai/ollama/status */
  114. export async function postAiOllamaStatus(body: {}, options?: { [key: string]: any }) {
  115. return request<Record<string, any>>('/api/ai/ollama/status', {
  116. method: 'POST',
  117. headers: {
  118. 'Content-Type': 'application/json'
  119. },
  120. data: body,
  121. ...(options || {})
  122. })
  123. }