/*
 * Copyright (c) 2024 LangChat. TyCoding All Rights Reserved.
 *
 * Licensed under the GNU Affero General Public License, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.gnu.org/licenses/agpl-3.0.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import request from '@/config/axios'

// AI 应用 API
export const AppApi = {
  // 获取应用列表
  getAppList: async (params: any) => {
    return await request.get({ url: '/aigc/app/list', params })
  },

  // 获取应用分页数据
  getAppPage: async (params: any) => {
    return await request.get({ url: '/aigc/app/page', params })
  },

  // 获取应用详情
  getApp: async (id: string) => {
    return await request.get({ url: `/aigc/app/${id}` })
  },

  // 根据模型ID获取应用
  getAppByModelId: async (id: string) => {
    return await request.get({ url: `/aigc/app/byModelId/${id}` })
  },

  // 获取应用API通道
  getAppApiChannel: async (appId: string) => {
    return await request.get({ url: `/aigc/app/channel/api/${appId}` })
  },

  // 新增应用
  createApp: async (data: any) => {
    return await request.post({ url: '/aigc/app', data })
  },

  // 更新应用
  updateApp: async (data: any) => {
    return await request.put({ url: '/aigc/app', data })
  },

  // 删除应用
  deleteApp: async (id: string) => {
    return await request.delete({ url: `/aigc/app/${id}` })
  }
}
