001/*
002 *  Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com).
003 *  <p>
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *  <p>
008 *  http://www.apache.org/licenses/LICENSE-2.0
009 *  <p>
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package com.agentsflex.core.model.client;
017
018import com.agentsflex.core.message.AiMessage;
019import com.agentsflex.core.model.chat.ChatContext;
020import com.agentsflex.core.model.chat.ChatModel;
021
022public class StreamContext {
023    private final ChatModel chatModel;
024    private final ChatContext chatContext;
025    private final StreamClient client;
026    private AiMessage fullMessage;
027    private Throwable throwable;
028
029
030    public StreamContext(ChatModel chatModel, ChatContext context, StreamClient client) {
031        this.chatModel = chatModel;
032        this.chatContext = context;
033        this.client = client;
034    }
035
036
037    public ChatModel getChatModel() {
038        return chatModel;
039    }
040
041    public ChatContext getChatContext() {
042        return chatContext;
043    }
044
045    public StreamClient getClient() {
046        return client;
047    }
048
049    public AiMessage getFullMessage() {
050        return fullMessage;
051    }
052
053    public void setFullMessage(AiMessage fullMessage) {
054        this.fullMessage = fullMessage;
055    }
056
057    public Throwable getThrowable() {
058        return throwable;
059    }
060
061    public void setThrowable(Throwable throwable) {
062        this.throwable = throwable;
063    }
064
065    public boolean isError() {
066        return throwable != null;
067    }
068}