办学质量监测教学评价系统
ageer
2025-05-11 84b8d6f675c2f3aed83e0503e79cf1fa05e888e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package org.ruoyi.common.chat.entity.chat;
 
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
 
import java.io.Serializable;
import java.util.List;
 
/**
 * @author https:www.unfbx.com
 * @since 2023-03-02
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
public class MessagePicture extends BaseMessage implements Serializable {
    /**
     * Content数组支持多图片输入
     * https://platform.openai.com/docs/guides/vision
     */
    private List<Content> content;
 
 
    public static Builder builder() {
        return new Builder();
    }
 
    /**
     * 构造函数
     *
     * @param role         角色
     * @param name         name
     * @param content      content
     * @param functionCall functionCall
     */
    public MessagePicture(String role, String name, List<Content> content, List<ToolCalls> toolCalls, String toolCallId, FunctionCall functionCall) {
        this.content = content;
        super.setRole(role);
        super.setName(name);
        super.setToolCalls(toolCalls);
        super.setToolCallId(toolCallId);
        super.setFunctionCall(functionCall);
    }
 
    public MessagePicture() {
    }
 
    private MessagePicture(Builder builder) {
        setContent(builder.content);
        super.setRole(builder.role);
        super.setName(builder.name);
        super.setFunctionCall(builder.functionCall);
        super.setToolCalls(builder.toolCalls);
        super.setToolCallId(builder.toolCallId);
    }
 
    public static final class Builder {
        private String role;
        private List<Content> content;
        private String name;
        private String toolCallId;
        private List<ToolCalls> toolCalls;
        private FunctionCall functionCall;
 
        public Builder() {
        }
 
        public Builder role(Role role) {
            this.role = role.getName();
            return this;
        }
 
        public Builder role(String role) {
            this.role = role;
            return this;
        }
 
        public Builder content(List<Content> content) {
            this.content = content;
            return this;
        }
 
        public Builder name(String name) {
            this.name = name;
            return this;
        }
 
        public Builder functionCall(FunctionCall functionCall) {
            this.functionCall = functionCall;
            return this;
        }
 
        public Builder toolCalls(List<ToolCalls> toolCalls) {
            this.toolCalls = toolCalls;
            return this;
        }
 
        public Builder toolCallId(String toolCallId) {
            this.toolCallId = toolCallId;
            return this;
        }
 
        public MessagePicture build() {
            return new MessagePicture(this);
        }
    }
 
}