zhangxiao
2024-08-05 a8b602e8c05e8d1cda15cdc419c4d17d4c113034
fix: 模型管理接口对接
3个文件已修改
2个文件已添加
45555 ■■■■ 已修改文件
package-lock.json 32446 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/interceptor.ts 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model.ts 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/index.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yarn.lock 13032 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
New file
Diff too large
src/api/interceptor.ts
@@ -41,7 +41,8 @@
      }
      config.headers.Authorization = `${authorization}`;
    }
    config.headers.Authorization = 'ImE4NGQ4ZWNjNGVmYjExZWZiZjRkMDI0MmFjMTIwMDA2Ig.ZqnIBw.ZX7_UxnSBKu8x_riQ5FrHLMAS78'
    config.headers.Authorization =
      'ImE4NGQ4ZWNjNGVmYjExZWZiZjRkMDI0MmFjMTIwMDA2Ig.ZqnIBw.ZX7_UxnSBKu8x_riQ5FrHLMAS78';
    return config;
  },
  (error) => {
@@ -53,11 +54,10 @@
axios.interceptors.response.use(
  (response: AxiosResponse<HttpResponse>) => {
    const res = response.data;
    // if the custom code is not 20000, it is judged as an error.
    if (
      (res.retcode && res.retcode !== 0) ||
      (res.code && res.code !== 20000)
      (res.code && res.code !== 20000 && res.code !== 200)
    ) {
      Message.error({
        content: res.msg || 'Error',
src/api/model.ts
New file
@@ -0,0 +1,69 @@
import axios from 'axios';
import qs from 'query-string';
import type { DescData } from '@arco-design/web-vue/es/descriptions/interface';
export interface PolicyRecord {
  id: string;
  number: number;
  name: string;
  contentType: 'img' | 'horizontalVideo' | 'verticalVideo';
  filterType: 'artificial' | 'rules';
  count: number;
  status: 'online' | 'offline';
  createdTime: string;
}
export interface PolicyParams extends Partial<PolicyRecord> {
  current: number;
  pageSize: number;
}
export interface PolicyListRes {
  list: PolicyRecord[];
  total: number;
}
// 接口上传
export function kbdocumentupload(params) {
  const config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      // token: token,
    },
  };
  return axios.post('/api/v1/document/upload', params, config);
}
// 获取大模型列表接口
export function modelList() {
  return axios.get('/api/v1/llm/list');
}
// 大模型tab列表
export function modelmyLlms() {
  return axios.get('/api/v1/llm/my_llms');
}
// 添加子模型
export function addLlm(params) {
  return axios.post('/api/v1/llm/add_llm', params);
}
// 删除子模型
export function deleteLlm(params) {
  return axios.post('/api/v1/llm/delete_llm', params);
}
// 获取子模型详情/llm/get_llm/Xinference/qwen2-7b
export function getLlmDetail(id, val) {
  return axios.get(`/api/v1/llm/get_llm/${id}/${val}`);
}
// 新增模型
export function addLlmFactory(params) {
  return axios.post('/api/v1/llm/add_llm_factory', params);
}
// 删除模型
export function deleteLlmFactory(name) {
  return axios.delete(`/api/v1/llm/delete_llm_factory/${name}`);
}
src/components/index.ts
@@ -10,6 +10,7 @@
  GraphicComponent,
} from 'echarts/components';
import Chart from './chart/index.vue';
import Upload from './upload/index.vue';
import Breadcrumb from './breadcrumb/index.vue';
// Manually introduce ECharts modules to reduce packing size
@@ -31,5 +32,6 @@
  install(Vue: App) {
    Vue.component('Chart', Chart);
    Vue.component('Breadcrumb', Breadcrumb);
    Vue.component('Upload', Upload);
  },
};
yarn.lock
Diff too large