Commit 4c8bb7c1 authored by 林洋洋's avatar 林洋洋

cookie 改为入参

parent 6f0ef400
......@@ -46,7 +46,7 @@ public class ChatController {
@Operation(summary = "创建对话", description = "创建对话")
@GetMapping("/create/client")
public R<ChatConversation> getConversationId(@Parameter(description = "智能体ID") @RequestParam Integer agentId,
@CookieValue(value = "userId") Long userId) {
@Parameter(description = "用户ID") @RequestParam Long userId) {
if(Objects.isNull(agentId)) {
throw new RuntimeException("userID不能为NULL!");
}
......
......@@ -82,7 +82,7 @@ public class ChatConversationController {
@GetMapping("/page")
public R<IPage<ChatConversation>> getPage(@Parameter(description = "分页对象") Page page,
@Parameter(description = "智能体Id") @RequestParam(required = false) Integer agentId,
@CookieValue(value = "userId") Long userId) {
@Parameter(description = "用户ID") @RequestParam Long userId) {
if(Objects.isNull(userId)){
throw new RuntimeException("userID 不能为NULL!");
}
......@@ -127,7 +127,7 @@ public class ChatConversationController {
@Operation(summary = "修改对话记录", description = "修改对话记录")
@PutMapping
public R<Boolean> updateById(@Parameter(description = "对话记录") @RequestBody ChatConversation chatConversation,
@CookieValue(value = "userId", defaultValue = "0") Long userId) {
@Parameter(description = "用户ID") @RequestParam Long userId) {
if(Objects.isNull(userId)){
throw new RuntimeException("userID 不能为NULL!");
}
......
......@@ -11,7 +11,7 @@ public class CorsConfig {
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
// 使用addAllowedOriginPattern代替addAllowedOrigin
corsConfiguration.addAllowedOriginPattern("*"); // 1允许任何域名使用
corsConfiguration.addAllowedOriginPattern("*");
corsConfiguration.addAllowedHeader("*"); // 2允许任何头
corsConfiguration.addAllowedMethod("*"); // 3允许任何方法(post、get等)
corsConfiguration.setAllowCredentials(true); // 支持安全证书。跨域携带cookie需要配置这个
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment