File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 22declare module 'katex'
33interface Window {
44 sendMessage : ?( ( message : string , other_params_data : any ) => void )
5+ chatUserProfile : ?( ( ) => any )
56 MaxKB : {
67 prefix : string
78 chatPrefix : string
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ import {
114114 onMounted ,
115115 onBeforeUnmount ,
116116 provide ,
117+ onBeforeMount ,
117118} from ' vue'
118119import { useRoute } from ' vue-router'
119120import applicationApi from ' @/api/application/application'
@@ -169,7 +170,7 @@ const emit = defineEmits([
169170 ' openParagraph' ,
170171 ' openParagraphDocument' ,
171172])
172- const { application, common } = useStore ()
173+ const { application, common, chatUser } = useStore ()
173174const isMobile = computed (() => {
174175 return common .isMobile () || mode === ' embed' || mode === ' mobile'
175176})
@@ -645,7 +646,16 @@ const handleScroll = () => {
645646 }
646647 }
647648}
648-
649+ onBeforeMount (() => {
650+ window .chatUserProfile = () => {
651+ if (props .type === ' ai-chat' ) {
652+ if (chatUser .chat_profile ?.authentication_type === ' login' ) {
653+ return chatUser .getChatUserProfile ()
654+ }
655+ }
656+ return Promise .resolve (null )
657+ }
658+ })
649659onMounted (() => {
650660 if (isUserInput .value && localStorage .getItem (` ${accessToken }userForm ` )) {
651661 const userFormData = JSON .parse (localStorage .getItem (` ${accessToken }userForm ` ) || ' {}' )
@@ -668,6 +678,7 @@ onMounted(() => {
668678
669679onBeforeUnmount (() => {
670680 window .sendMessage = null
681+ window .userProfile = null
671682})
672683
673684function setScrollBottom() {
Original file line number Diff line number Diff line change 1- import { defineStore } from 'pinia'
1+ import { defineStore } from 'pinia'
22import ChatAPI from '@/api/chat/chat'
3- import type { ChatProfile , ChatUserProfile } from '@/api/type/chat'
4- import type { LoginRequest } from '@/api/type/user'
5- import type { Ref } from 'vue'
6- import { getBrowserLang } from '@/locales/index'
3+ import type { ChatProfile , ChatUserProfile } from '@/api/type/chat'
4+ import type { LoginRequest } from '@/api/type/user'
5+ import type { Ref } from 'vue'
6+ import { getBrowserLang } from '@/locales/index'
77
88interface ChatUser {
99 // 用户id
@@ -41,6 +41,7 @@ const useChatUserStore = defineStore('chat-user', {
4141 async getChatUserProfile ( ) {
4242 const res = await ChatAPI . getChatUserProfile ( )
4343 this . chatUserProfile = res . data
44+ return res . data
4445 } ,
4546 applicationProfile ( ) {
4647 return ChatAPI . applicationProfile ( ) . then ( ( ok ) => {
@@ -148,7 +149,6 @@ const useChatUserStore = defineStore('chat-user', {
148149 return ok . data
149150 } )
150151 } ,
151-
152152 } ,
153153} )
154154
You can’t perform that action at this time.
0 commit comments