1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import {
- bluebookAiAgent,
- } from '@/lib/api/index'
- import request from '@/lib/module/axios.js'
- import { TAgentDetail, TComponentItem } from '@/types/agent'
- // 创建一个新的智能体--用户点击创建按钮时调用获取新智能体id与名称信息
- export const createAgent = (data: TAgentDetail) => {
- return request.post<TAgentDetail>(`${bluebookAiAgent}api/v1/my/agent`, data)
- }
- // 获取我的智能体详细信息
- // 供编辑页使用,预览页使用智能体信息接口获取
- export const getAgent = (agentId: string) => {
- return request.get<TAgentDetail>(`${bluebookAiAgent}api/v1/my/agent/${agentId}`)
- }
- // 编辑智能体--设置形象ID
- export const editAgentAvatar = (agentId: string, avatarUrl: string, enabledChatBg:boolean) => {
- return request.put(`${bluebookAiAgent}api/v1/my/agent/${agentId}/avatar`, {
- avatarUrl,
- enabledChatBg,
- })
- }
- // 设置当前我的默认智能体
- export const setDefaultAgent = (agentId: string) => {
- return request.put(`${bluebookAiAgent}api/v1/my/agent/${agentId}/default`)
- }
- // 编辑智能体--微官网组件
- export const editAgentWebsite = (agentId: string, data: {components: TComponentItem[]}) => {
- return request.put(`${bluebookAiAgent}api/v1/my/agent/${agentId}/website`, data)
- }
- // 编辑智能体--名片部份内容
- // address (string, optional): 地址,长度最多250 ,
- // email (string, optional): 邮箱,长度最多50 ,
- // entName (string, optional): 企业名称,长度最多100,如果是个人版允许编辑、企业版可以原值传入即可 ,
- // mobile (string, optional): 手机号 ,
- // name (string, optional): 智能体名称--名片的姓名;长度最多20 ,
- // position (string, optional): 职位,长度最多30 ,
- // qrCodeUrl (string, optional): 二维码地址,长度最多250
- export type TAgentContactCard = {
- "address"?: string,
- "email"?: string,
- "entName"?: string,
- "mobile"?: string,
- "name"?: string,
- "position"?: string,
- "qrCodeUrl"?: string
- }
- export const editAgentCard = (agentId: string, data: TAgentContactCard) => {
- return request.put<any, any>(`${bluebookAiAgent}api/v1/my/agent/${agentId}/card`, data)
- }
- export type TAgent = {
- "agentId": "string",
- "isDefault": boolean,
- "isEnt": boolean,
- "isNewEnt": boolean,
- "name": "string"
- }
- // 我的智能体列表
- export const getAgents = () => {
- return request.get<TAgent>(`${bluebookAiAgent}api/v1/my/agents`)
- }
- // 删除智能体--仅允许删除个人智能体
- export const deleteAgent = (agentId: string) => {
- return request.delete(`${bluebookAiAgent}api/v1/my/agent/${agentId}`)
- }
|