import { ref } from "vue"; import type { AgentDetailDto, AgentManualComponentInfo, GuidQuestionDto, FileNode, } from "@/types/interfaces/agent"; import { BindConfigWithSub } from "@/types/interfaces/common"; import { MessageInfo, ConversationInfo, ProcessingInfo, OpenAppParams, } from "@/types/interfaces/conversationInfo"; import { SandboxInfo } from "@/types/interfaces/sandbox"; /** * 数据层:负责状态管理和数据存储 */ export default class AgentDetailData { // 基础信息 agentId = ref(null); agentName = ref(""); agentInfo = ref(null); conversationId = ref(null); // 是否是临时会话 isTempChat = ref(false); // 首页页面URL pageHomeUrl = ref(""); // 首页页面弹窗 popupPage = ref(null); // 消息相关 messageList = ref([]); // 引导问题建议 chatSuggestList = ref([]); requestId = ref(""); messageIdRef = ref(""); // 当前会话消息请求ID currentConversationRequestId = ref(""); // 停止操作是否正在进行中 isStoppingConversation = ref(false); // 会话状态 conversationInfo = ref(null); // 是否用户问题建议 isSuggest = ref(false); // 是否需要更新主题 needUpdateTopicRef = ref(true); // 是否正在加载会话 isLoadingConversation = ref(false); // 会话是否正在进行中(有消息正在处理) isConversationActive = ref(false); // 是否发送过消息,如果是,则禁用变量参数 isSendMessageRef = ref(false); // 是否禁用发送按钮 wholeDisabled = ref(false); // ==================== 临时会话相关 ==================== // 链接Key chatKey = ref(""); // 验证码参数 captchaVerifyParam = ref(""); // 会话唯一标识 // 会话唯一标识 conversationUid = ref(""); // ==================== 沙盒相关 ==================== // 沙盒列表 sandboxList = ref([]); // 智能体选中的沙盒映射 agentSelectedSandbox = ref<{ [key: string]: string }>({}); // 当前选中的沙盒ID currentSandboxId = ref(""); // 是否允许切换沙盒 (当ID固定时为true) isSandboxSwitchDisabled = ref(false); // 沙盒是否不可用 (当显示"电脑不可用"时为true) isSandboxUnavailable = ref(false); // 沙盒不可用时的提示文案 sandboxDisabledText = ref(""); // ==================== 模型选择相关 ==================== // 当前选中的模型ID currentModelId = ref(0); // 当前选中的模型名称 currentModelName = ref(""); // 模型选择弹窗是否可见 modelSelectVisible = ref(false); // 组件和功能 manualComponents = ref([]); // 已选组件列表 selectedComponents = ref([]); // 变量参数 variables = ref([]); // 用户填充变量 userFillVariables = ref<{ [key: string]: string | number }>({}); processingList = ref([]); messageRefs = ref<{ [key: string]: any }>({}); // 滚动相关 scrollIntoView = ref(""); scrollInBottom = ref(true); scrollWithAnimation = ref(false); scrollTouch = ref(false); scrolling = ref(false); keyboardHeight = ref(0); // 弹窗引用 refMorePopup = ref(null); refSubscriptionModal = ref(null); sseProcessor: any = null; autoToLastMsg = ref(false); scrollingT = ref(0); mouseScroll = ref(false); needSetLockAutoToLastMsg = ref(true); // ==================== 任务型智能体文件列表相关 ==================== // 文件列表 fileList = ref([]); // 是否正在加载文件列表 isLoadingFiles = ref(false); // ==================== 加载更多历史消息相关 ==================== // 是否正在加载更多消息 isLoadingMoreMessages = ref(false); // 是否还有更多历史消息 hasMoreMessages = ref(false); // ==================== 开放应用参数, 来自用户自定义url地址传入的参数params ==================== appParams = ref(null); // 如果没有携带message参数,则将其他参数(files、attachments、selectedComponents、skillIds、modelId等)保存到urlOtherParams中,用于后续首次发送消息时使用 urlOtherParams = ref<{ [key: string]: string }>({}); // ==================== 订阅和付费限制相关 ==================== // 是否需要付费/订阅锁定 subscriptionRequired = ref(false); // 付费/订阅弹窗可见性 subscriptionModalVisible = ref(false); // 是否允许开启订阅限制(根据租户配置中的 enableSubscription 是否等于 1 来决定) enableSubscription = ref(0); }