Files
zhxg_app/api/aiChat/ai_index.js
2025-08-14 11:42:34 +08:00

78 lines
1.5 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// src/api/ai_index.js
// import request from '@/utils/ai_request.js'
import request from "@/utils/ai_request.js";
// 获取历史
export const getHistory = ({
conversationId,
user,
limit = 20,
beforeId
}) => {
const params = {
conversationId,
user,
limit
};
// 如果有beforeId参数添加到请求中后端参数名为firstId
if (beforeId) {
params.firstId = beforeId;
}
return request({
url: '/aitutor/aichat/getMessagesToUser',
method: 'get',
params
});
};
// export const getHistory = ({
// conversationId,
// user,
// limit = 20
// }) => {
// return request({
// url: '/aitutor/aichat/getMessagesToUser',
// method: 'get',
// params: {
// conversationId,
// user,
// limit
// }
// // headers: {
// // Authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjBmMTY3NmY2LTgwOGMtNGUwMC04NDJjLWIwNmY1ZTM5NzJlNCJ9.VVc6OwQ-Xn9pxzYbPhlCpvDp6TwESS00gJi9IXUEIbFw4RFACZDmYCYjQ7voTM4fppy9SAMJCWT-L7Uy-K1eqw'
// // }
// });
// };
// 点赞/点踩 action: 1 点赞 0 点踩
export const sendFeedback = ({
messageId,
action,
user
}) => {
return request({
url: '/aitutor/aichat/feedback',
method: 'post',
data: {
message_id: messageId,
rating: action === 1 ? 'like' : 'dislike', // 添加rating参数
user
}
});
};
// export const sendFeedback = ({
// messageId,
// action
// }) => {
// return request({
// url: '/api/chat/feedback',
// method: 'post',
// data: {
// messageId,
// action
// }
// });
// };