import { defineStore } from 'pinia' import OpenAI from 'openai' export const useMsgStore = defineStore('msg', { state: () => ({ msgUuid: '', messages: [], pageInfoList: [], AIModel: {}, openai: null }), actions: { updateAIModel(model: any) { this.AIModel = model this.openai = new OpenAI({ // apiKey: import.meta.env.VITE_OPENAI_API_KEY_TONG, apiKey: import.meta.env.VITE_OPENAI_API_KEY_TONG, baseURL: this.AIModel.url, // timeout: 5000, dangerouslyAllowBrowser: true }) } } })