|
@@ -31,14 +31,17 @@ public class UserInfo extends AbstractAgent implements Function<UserInfo.Request
|
|
|
@Override
|
|
|
public String apply(Request request) {
|
|
|
System.out.println(request.userName);
|
|
|
+ System.out.println(request.userId);
|
|
|
return ChatClient.create(chatModel)
|
|
|
.prompt()
|
|
|
- .system(s -> s.text("用户名为{userName},需要查询成绩信息。问题:{query}")
|
|
|
+ .system(s -> s.text("用户名为{userName},用户id为{userId},需要查询成绩信息。问题:{query}")
|
|
|
.param("userName", request.userName)
|
|
|
+ .param("userId", request.userId)
|
|
|
.param("query", request.query()))
|
|
|
.functions(getFunctions(UserNameFunction.class))
|
|
|
.user(userSpec -> userSpec
|
|
|
.param("userName", request.userName) // 传递参数
|
|
|
+ .param("userId", request.userId)
|
|
|
.text(request.query()))
|
|
|
.call()
|
|
|
.content();
|
|
@@ -47,7 +50,11 @@ public class UserInfo extends AbstractAgent implements Function<UserInfo.Request
|
|
|
public record Request(
|
|
|
@JsonProperty(required = true) @JsonPropertyDescription(value = "用户原始的提问") String query,
|
|
|
@JsonProperty(required = true)
|
|
|
- @JsonPropertyDescription("this param is user's name")
|
|
|
- String userName) {
|
|
|
+ @JsonPropertyDescription("用户名称")
|
|
|
+ String userName,
|
|
|
+ @JsonProperty(required = true)
|
|
|
+ @JsonPropertyDescription("用户id")
|
|
|
+ String userId
|
|
|
+ ) {
|
|
|
}
|
|
|
}
|