20 lines
572 B
TypeScript
20 lines
572 B
TypeScript
import { post } from '../utils/request';
|
|
|
|
export interface AiChatResponse {
|
|
message: string;
|
|
intent?: string;
|
|
recommendations?: Array<{ couponId: string; name: string; reason: string }>;
|
|
}
|
|
|
|
/** 发送消息到AI助手 */
|
|
export function chat(message: string, context?: string) {
|
|
return post<AiChatResponse>('/api/v1/ai/chat', { message, context });
|
|
}
|
|
|
|
/** 获取AI推荐券 */
|
|
export function getRecommendations() {
|
|
return post<Array<{ couponId: string; name: string; reason: string; price: number; discount: number }>>(
|
|
'/api/v1/ai/recommendations',
|
|
);
|
|
}
|