We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我分为三个代码块介绍吧 Controller类 public AIController(ChatClient.Builder builder, ChatMemory chatMemory) { this.chatClient = builder .defaultFunctions("psychologicalHealthAssessment") //调用函数(见Function处理类) .build(); }
Function处理类 @bean @description("做出心理健康评估") public Function<PapersRequest, String> psychologicalHealthAssessment(){ return request -> { Result evaluation = papersService.getEvaluation(1); 在此处报错 UserPapersDetailVo data = (UserPapersDetailVo )evaluation.getData(); return data.getEvaluation(); }; } 具体到Service类,即 StpUtil.getSession().这里报错。 public Result getEvaluation(int id) { User user = (User) StpUtil.getSession().get("user"); 在此处报错 Long userId = user.getId(); UserPapers userPapers = userPapersService.lambdaQuery() .eq(UserPapers::getUserId, userId) .eq(UserPapers::getPaperId, id) .one(); if (userPapers == null) { return Result.build(null,404, "你尚未开始作答试卷"); } UserPapersDetailVo userPapersDetailVo = BeanUtil.copyProperties(userPapers, UserPapersDetailVo.class); return Result.ok(userPapersDetailVo); }
主要是不明白哪里是非web上下文操作,这应该是标准的web操作啊,我也保证都注册到web容器了
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我分为三个代码块介绍吧
Controller类
public AIController(ChatClient.Builder builder, ChatMemory chatMemory) {
this.chatClient = builder
.defaultFunctions("psychologicalHealthAssessment") //调用函数(见Function处理类)
.build();
}
Function处理类
@bean
@description("做出心理健康评估")
public Function<PapersRequest, String> psychologicalHealthAssessment(){
return request -> {
Result evaluation = papersService.getEvaluation(1); 在此处报错
UserPapersDetailVo data = (UserPapersDetailVo )evaluation.getData();
return data.getEvaluation();
};
}
具体到Service类,即 StpUtil.getSession().这里报错。
public Result getEvaluation(int id) {
User user = (User) StpUtil.getSession().get("user"); 在此处报错
Long userId = user.getId();
UserPapers userPapers = userPapersService.lambdaQuery()
.eq(UserPapers::getUserId, userId)
.eq(UserPapers::getPaperId, id)
.one();
if (userPapers == null) {
return Result.build(null,404, "你尚未开始作答试卷");
}
UserPapersDetailVo userPapersDetailVo = BeanUtil.copyProperties(userPapers, UserPapersDetailVo.class);
return Result.ok(userPapersDetailVo);
}
主要是不明白哪里是非web上下文操作,这应该是标准的web操作啊,我也保证都注册到web容器了
The text was updated successfully, but these errors were encountered: