123456789101112131415161718192021222324 |
- import { defineStore } from 'pinia'
- import OpenAI from 'openai'
- export const useMsgStore = defineStore('msg', {
- state: () => ({
- msgUuid: <string>'',
- messages: <any[]>[],
- pageInfoList: [],
- AIModel: <any>{},
- openai: <any>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
- })
- }
- }
- })
|