wujingjing
2025-01-09 6a475521b957b2c3a68ee950704f8f1948bd6cf9
src/api/ai/chat.ts
@@ -259,7 +259,7 @@
 * @description 流式大模型对话
 * @param {FormData} params
 **/
export const questionStreamByPost = (params, callback: (chunkRes) => void) =>
export const questionStreamByPost = (params, callback: (chunkRes) => void, extraData: any = {}) =>
   streamReq(
      {
         url: `/chat/question_stream`,
@@ -269,6 +269,7 @@
         headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
         },
         ...extraData,
      },
      callback
   );
@@ -299,7 +300,7 @@
      },
   });
};
//修改对话分组列表标题
export const setHistoryGroupTitle = async (params, req: any = request) => {
   return req({
      url: 'history/set_history_group_title',
@@ -390,15 +391,15 @@
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
}
};
/**
 * 添加用户自定义例子
 * @param params
 * @param req
 * @returns
 * @param params
 * @param req
 * @returns
 */
export const addUserSample = (params,req:any=request) =>{
export const addUserSample = (params, req: any = request) => {
   return req({
      url: 'chat/add_user_sample',
      method: 'POST',
@@ -407,4 +408,108 @@
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
}
};
/**
 *
查询用户自定义例子
 * @param params
 * @param req
 * @returns
 */
export const listUserSample = (params, req: any = request) => {
   return req({
      url: 'chat/list_user_sample',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
/**
 *
修改用户自定义例子
 * @param params
 * @param req
 * @returns
 */
export const updateUserSample = (params, req: any = request) => {
   return req({
      url: 'chat/update_user_sample',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
/**
 *
删除用户自定义例子
 * @param params
 * @param req
 * @returns
 */
export const deleteUserSample = (params, req: any = request) => {
   return req({
      url: 'chat/delete_user_sample',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
/**
 * @description 将当前对话历史分享
 * @param {FormData} params
 **/
export const shareChatHistoryByPost = (params) =>
   request({
      url: `/chat/share_chat_history`,
      method: 'post',
      params: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
/**
 * @description 查询异步结果
 * @param {FormData} params
 **/
export const shareAsyncQueryByPost = (params) =>
   request({
      url: `/chat/share_async_query`,
      method: 'post',
      params: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
/**
 * @description 将当前对话历史分享
 * @param {FormData} params
 **/
export const getShareChatJsonByPost = (params) =>
   request({
      url: `/chat/get_share_chat_json`,
      method: 'post',
      params: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
   export const question_stream_reply = (params) =>
   request({
      url: `/chat/question_stream_reply`,
      method: 'post',
      params: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });