2025年4月15日15:40:40
parent
4eeae05de5
commit
a3453ce343
|
|
@ -1,60 +0,0 @@
|
||||||
package com.zhangmeng.deepseek.local.chat.entity.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 学科表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author huge
|
|
||||||
* @since 2025-03-08
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("course")
|
|
||||||
public class Course implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 学科名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 学历背景要求:0-无,1-初中,2-高中、3-大专、4-本科以上
|
|
||||||
*/
|
|
||||||
private Integer edu;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程类型:编程、设计、自媒体、其它
|
|
||||||
*/
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程价格
|
|
||||||
*/
|
|
||||||
private Long price;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 学习时长,单位: 天
|
|
||||||
*/
|
|
||||||
private Integer duration;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
package com.zhangmeng.deepseek.local.chat.entity.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author huge
|
|
||||||
* @since 2025-03-08
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("course_reservation")
|
|
||||||
public class CourseReservation implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预约课程
|
|
||||||
*/
|
|
||||||
private String course;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 学生姓名
|
|
||||||
*/
|
|
||||||
private String studentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系方式
|
|
||||||
*/
|
|
||||||
private String contactInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预约校区
|
|
||||||
*/
|
|
||||||
private String school;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package com.zhangmeng.deepseek.local.chat.entity.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 校区表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author huge
|
|
||||||
* @since 2025-03-08
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("school")
|
|
||||||
public class School implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校区名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校区所在城市
|
|
||||||
*/
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package com.zhangmeng.deepseek.local.chat.entity.query;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.ai.tool.annotation.ToolParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CourseQuery {
|
|
||||||
@ToolParam(required = false, description = "课程类型:编程、设计、自媒体、其它")
|
|
||||||
private String type;
|
|
||||||
@ToolParam(required = false, description = "学历要求:0-无、1-初中、2-高中、3-大专、4-本科及本科以上")
|
|
||||||
private Integer edu;
|
|
||||||
@ToolParam(required = false, description = "排序方式")
|
|
||||||
private List<Sort> sorts;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class Sort {
|
|
||||||
@ToolParam(required = false, description = "排序字段: price或duration")
|
|
||||||
private String field;
|
|
||||||
@ToolParam(required = false, description = "是否是升序: true/false")
|
|
||||||
private Boolean asc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -35,12 +35,28 @@ public class InMemoryChatHistoryRepository implements ChatHistoryRepository {
|
||||||
|
|
||||||
private final ChatMemory chatMemory;
|
private final ChatMemory chatMemory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type 业务类型,如:chat、service、pdf
|
||||||
|
* @param chatId 会话ID
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void save(String type, String chatId) {
|
public void save(String type, String chatId) {
|
||||||
/*if (!chatHistory.containsKey(type)) {
|
/*if (!chatHistory.containsKey(type)) {
|
||||||
chatHistory.put(type, new ArrayList<>());
|
chatHistory.put(type, new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<String> chatIds = chatHistory.get(type);*/
|
List<String> chatIds = chatHistory.get(type);*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* computeIfAbsent是Java 8引入的一个非常有用的Map方法,其签名如下:
|
||||||
|
* default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction)
|
||||||
|
* CopyInsert
|
||||||
|
* 参数:
|
||||||
|
* key:要查找的键。
|
||||||
|
* mappingFunction:一个函数,如果指定的键不存在,则用于计算新值的函数。
|
||||||
|
* 返回值:如果键存在,则返回键对应的值;如果键不存在,则计算一个新的值并将其与键关联,然后返回这个新值。
|
||||||
|
*/
|
||||||
|
|
||||||
List<String> chatIds = chatHistory.computeIfAbsent(type, k -> new ArrayList<>());
|
List<String> chatIds = chatHistory.computeIfAbsent(type, k -> new ArrayList<>());
|
||||||
if (chatIds.contains(chatId)) {
|
if (chatIds.contains(chatId)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue