mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 02:03:42 +08:00
rename Token to User, the chat history function is ready
This commit is contained in:
@@ -10,7 +10,7 @@ axios.defaults.headers.post['Content-Type'] = 'application/json'
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
// set token
|
||||
config.headers['ChatGPT-Token'] = getSessionId();
|
||||
config.headers['ChatGPT-TOKEN'] = getSessionId();
|
||||
return config
|
||||
}, error => {
|
||||
return Promise.reject(error)
|
||||
|
||||
@@ -185,10 +185,13 @@ export default defineComponent({
|
||||
|
||||
window.addEventListener("resize", () => {
|
||||
this.chatBoxHeight = window.innerHeight - this.toolBoxHeight;
|
||||
this.inputBoxWidth = window.innerWidth - 20;
|
||||
});
|
||||
|
||||
this.connect();
|
||||
|
||||
this.fetchChatHistory();
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -300,6 +303,17 @@ export default defineComponent({
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.fetchChatHistory();
|
||||
},
|
||||
|
||||
// 从后端获取聊天历史记录
|
||||
fetchChatHistory: function () {
|
||||
httpPost("/api/chat/history", {role: this.role}).then((res) => {
|
||||
this.chatData = res.data
|
||||
}).catch((e) => {
|
||||
console.error(e.message)
|
||||
})
|
||||
},
|
||||
|
||||
inputKeyDown: function (e) {
|
||||
|
||||
Reference in New Issue
Block a user