From 5a6f070f9228818fcdcb5695df37ea3ecd394f34 Mon Sep 17 00:00:00 2001 From: RockYang Date: Fri, 7 Apr 2023 17:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20Plus=20=E9=BB=91=E8=89=B2?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/chat_handler.go | 10 +- web/src/assets/img/bg_01.jpeg | Bin 0 -> 824 bytes web/src/assets/img/bg_02.jpeg | Bin 0 -> 1835 bytes web/src/components/ChatReply.vue | 1 + web/src/components/plus/ChatPrompt.vue | 85 ++++ web/src/components/plus/ChatReply.vue | 93 ++++ web/src/main.js | 7 +- web/src/views/Chat.vue | 6 +- web/src/views/ChatPlus.vue | 651 +++++++++++++++++++++++++ 9 files changed, 842 insertions(+), 11 deletions(-) create mode 100644 web/src/assets/img/bg_01.jpeg create mode 100644 web/src/assets/img/bg_02.jpeg create mode 100644 web/src/components/plus/ChatPrompt.vue create mode 100644 web/src/components/plus/ChatReply.vue create mode 100644 web/src/views/ChatPlus.vue diff --git a/server/chat_handler.go b/server/chat_handler.go index 4867322..1aca89f 100644 --- a/server/chat_handler.go +++ b/server/chat_handler.go @@ -57,11 +57,13 @@ func (s *Server) ChatHandle(c *gin.Context) { } logger.Info("Receive a message: ", string(message)) + replyMessage(client, "当前 TOKEN 无效,请使用合法的 TOKEN 登录!", false) + replyMessage(client, "![](images/wx.png)", true) // TODO: 当前只保持当前会话的上下文,部保存用户的所有的聊天历史记录,后期要考虑保存所有的历史记录 - err = s.sendMessage(session, chatRole, string(message), client, false) - if err != nil { - logger.Error(err) - } + //err = s.sendMessage(session, chatRole, string(message), client, false) + //if err != nil { + // logger.Error(err) + //} } }() } diff --git a/web/src/assets/img/bg_01.jpeg b/web/src/assets/img/bg_01.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..de1bea0cc988b700cde3ce4bf0dbbd4b7ed5e08c GIT binary patch literal 824 zcmb7=!D|yy5XNWT?#m`GA)9U1O^j(%8=_llF$zKvV^@WuJw=eXh)7OS=tZHIrlPNZ zK|F}`BJ8n;AUSw!aRqN))`P{`%Stb?Dg;zKSctQ!2leJWb`LY(``-7P!Mi~SnfbY^ zbAX6&g$@jM;4;Ki9^+~(#$%cmi;Ij9iG(oIdMcAM^ZA@vq-a#2)-KMPr$ z1``=j5SRkdIVik%+PHS~(keT1Z{p<}(wP6;Bw5ro{`QNy?;#br8Hxe3@Ufmo*YI_x z20ud08;Mn($!}mY7#zfqtXU@d4UamnNjCACjGfoAc5DYKyJjmYywq zx`j@I$qsMM`iosA-F#Pq)&fNVgcQ zD{uF)KC-%y&0A3_SHFWjW07sCon(;nN{`tR?!mW66{TfCIiN^NkaSk6x(idXI1~`o zI>#@4B`}jtjWt-;WLwI%>_A#R!y*#+00JUEutAq7#{40A^Bnlsv8TO&x*qZVCM0?{ zEjO_Uq2Mi*rsmMRJ=D-@YR!DkD@&+3wvhE)NIz15&3^(dW{P!3qjzVpm+W)ey5OE| z^aNk&CtQJ_Fv>n_tMDCKxJPUyTD&v66AFK&I_A^k+J|l`8EEhnXtVJB;V>T2wVeim z(W*ZC4IU~kc3=w&_r2n>Q~3Ib`^5{+#xnZp^I>d5?!NA;^eOEbTB>(^b literal 0 HcmV?d00001 diff --git a/web/src/assets/img/bg_02.jpeg b/web/src/assets/img/bg_02.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..7c1925fb84788783874ed1cab4f943645bf8d821 GIT binary patch literal 1835 zcmb7;YgCd69*5ueML@|5Am9y)1xZv)8*is9(?$%jQVP7M<|PYE%gSs_LnmFMX=-MQJW(5QW z03Zkg%=H7-UI1SM2m?3*Zh%0*5lAG$5QRpejEqn?Q!`_<13dFMu%wDu4mJZ=?N`7U2Cg^2Fu*QA|J(UZwUd#ip&rcM_iah81eoI z+mR55JJBSVT6~en4b%NBcAwBqDM~tG3MucvsK!z2dP7OD*)HEy`~3`3^UUZdUi7|Zp0;oVABYsBsGo_=XN`iw)6xveyfx)|A>tqQ&L321qXI$Ed&t`Ho@`rt_647ewZFog}xghx-pK29v z@w=UwPRrghodNJSGPm~+yK=HpZoLeUHUR9oyVQ;(zetry)XClM{XTE#x&l^R;{0w^q1-!aCr!(GoZhl)FY7Te z)>`DwS-6#*L>=c5i$>1e%X7THg2R1_(+~30t)q z+#>KQpA@RkP`f1(rE(dPeYrXhoh!|#TEHYK9sY*=YXQDZc$MTeh)<`h_5HX3%?Xwh)D50Wr(xzw z=MAbkKlpPqMcj+Rf)Q>8@Y0eX(x6z+VDvDt$0?E*W*W46|4^r}dGmNi;1mtEUB2c5 z2vl!{E!;KWuqkeQuEzIiU<5LFUZA7B#{ z#w*2GzEQr_tLaRYTc%C{&(aXmXJQ0f8g0l$i;a|a(Hi^ z^oNo%hj+aub(J5%f>?=DSM_FDV*GMm!-S_eu#??QH|gW=OEGFRn^?^ym(S|KssYD` zVJUDM`Ju!O;CDscg>+SO(;eqTe=cuFYZ|@gYb|WK(Kl>F`>o%Sa+sai{*vif z^aPIONxD=NS?J%zl+asQU}DQ&!=`cXUMsDioU4>=C~QAC=DO|k$+Sd9xVz-D%87N2 zT|rb7)0#!C41#m0fUvBG?QzRMyqfWqMNiV+eYqIe6P5j-J!qH8@%hYiLG=ma3r}}9 zFF4pl-bGp9*8tW(;(ob#-ZrN{+{o@u7HJmG^U^9@0?|~S)0?oVT3NgwvGn)D5%K#q z^fN28yVELS8l6&_nKpor9Lz4;XCC8w;At_|mc!&!oC&W9SdLEk1fJyfNBF)@txTsW XSAAzsSKh$eBx`d|ENyDKvNrZ_)ok+O literal 0 HcmV?d00001 diff --git a/web/src/components/ChatReply.vue b/web/src/components/ChatReply.vue index b6923ba..aa3d99a 100644 --- a/web/src/components/ChatReply.vue +++ b/web/src/components/ChatReply.vue @@ -62,6 +62,7 @@ export default defineComponent({ } .content { + min-height 20px; word-break break-word; padding: 8px 10px; color var(--content-color) diff --git a/web/src/components/plus/ChatPrompt.vue b/web/src/components/plus/ChatPrompt.vue new file mode 100644 index 0000000..33c70e7 --- /dev/null +++ b/web/src/components/plus/ChatPrompt.vue @@ -0,0 +1,85 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/plus/ChatReply.vue b/web/src/components/plus/ChatReply.vue new file mode 100644 index 0000000..5e3860e --- /dev/null +++ b/web/src/components/plus/ChatReply.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/web/src/main.js b/web/src/main.js index 8c2d187..9bb8c20 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -3,17 +3,14 @@ import {createApp} from 'vue' import ElementPlus from "element-plus" import "element-plus/dist/index.css" import App from './App.vue' -import Chat from './views/Chat.vue' +import ChatPlus from "@/views/ChatPlus.vue"; import NotFound from './views/404.vue' import TestPage from './views/Test.vue' import './utils/prototype' -import {Global} from "@/utils/storage"; - -Global['Chat'] = Chat const routes = [ { - name: 'home', path: '/', component: Chat, meta: { + name: 'chat-plus', path: '/', component: ChatPlus, meta: { title: 'ChatGPT-Plus' } }, diff --git a/web/src/views/Chat.vue b/web/src/views/Chat.vue index 784bfd1..b84be6e 100644 --- a/web/src/views/Chat.vue +++ b/web/src/views/Chat.vue @@ -132,7 +132,7 @@ export default defineComponent({ connectingMessageBox: null, // 保存重连的消息框对象 errorMessage: null, // 错误信息提示框 socket: null, - toolBoxHeight: 61 + 42, // 工具框的高度 + toolBoxHeight: 61 + 52, // 工具框的高度 inputBoxWidth: window.innerWidth - 20, sending: true, loading: true @@ -486,6 +486,8 @@ export default defineComponent({ .body { background-color: rgba(247, 247, 248, 1); + + background-image url("~@/assets/img/bg_01.jpeg") display flex; //justify-content center; align-items flex-start; @@ -544,7 +546,7 @@ export default defineComponent({ .input-box { padding 10px; - width 100%; + background #ffffff; position: absolute; bottom: 0 diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue new file mode 100644 index 0000000..2a6d859 --- /dev/null +++ b/web/src/views/ChatPlus.vue @@ -0,0 +1,651 @@ + + + + +