镜像自地址
https://github.com/binary-husky/gpt_academic.git
已同步 2025-12-06 14:36:48 +00:00
history ng patch 1
这个提交包含在:
@@ -940,17 +940,17 @@ function gpt_academic_gradio_saveload(
|
|||||||
|
|
||||||
function update_conversation_metadata() {
|
function update_conversation_metadata() {
|
||||||
// Create a conversation UUID and timestamp
|
// Create a conversation UUID and timestamp
|
||||||
const conversationId = crypto.randomUUID();
|
try {
|
||||||
const timestamp = new Date().toISOString();
|
const conversationId = crypto.randomUUID();
|
||||||
const conversationData = {
|
const timestamp = new Date().toISOString();
|
||||||
id: conversationId,
|
const conversationData = {
|
||||||
timestamp: timestamp
|
id: conversationId,
|
||||||
};
|
timestamp: timestamp
|
||||||
// Save to cookie
|
};
|
||||||
setCookie("conversation_metadata", JSON.stringify(conversationData), 2);
|
setCookie("conversation_metadata", JSON.stringify(conversationData), 2);
|
||||||
// read from cookie
|
} catch (e) {
|
||||||
let conversation_metadata = getCookie("conversation_metadata");
|
console.error('Error in updating conversation metadata:', e);
|
||||||
// console.log("conversation_metadata", conversation_metadata);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -970,16 +970,23 @@ async function save_conversation_history() {
|
|||||||
let chatbot = await get_data_from_gradio_component('gpt-chatbot');
|
let chatbot = await get_data_from_gradio_component('gpt-chatbot');
|
||||||
let history = await get_data_from_gradio_component('history-ng');
|
let history = await get_data_from_gradio_component('history-ng');
|
||||||
let conversation_metadata = getCookie("conversation_metadata");
|
let conversation_metadata = getCookie("conversation_metadata");
|
||||||
conversation_metadata = JSON.parse(conversation_metadata);
|
let conversation = {};
|
||||||
// console.log("conversation_metadata", conversation_metadata);
|
try {
|
||||||
let conversation = {
|
conversation_metadata = JSON.parse(conversation_metadata);
|
||||||
timestamp: conversation_metadata.timestamp,
|
conversation = {
|
||||||
id: conversation_metadata.id,
|
timestamp: conversation_metadata.timestamp,
|
||||||
metadata: conversation_metadata,
|
id: conversation_metadata.id,
|
||||||
conversation: chatbot,
|
metadata: conversation_metadata,
|
||||||
history: history,
|
conversation: chatbot,
|
||||||
preview: generatePreview(JSON.parse(history), conversation_metadata.timestamp)
|
history: history,
|
||||||
};
|
preview: generatePreview(JSON.parse(history), conversation_metadata.timestamp)
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
console.log(history);
|
||||||
|
console.error('Conversation metadata parse error');
|
||||||
|
update_conversation_metadata();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get existing conversation history from local storage
|
// Get existing conversation history from local storage
|
||||||
let conversation_history = [];
|
let conversation_history = [];
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ def update_ui(chatbot:ChatBotWithCookies, history:list, msg:str="正常", **kwar
|
|||||||
else:
|
else:
|
||||||
chatbot_gr = chatbot
|
chatbot_gr = chatbot
|
||||||
|
|
||||||
|
history = [str(history_item) for history_item in history] # ensure all items are string
|
||||||
json_history = json.dumps(history, ensure_ascii=False)
|
json_history = json.dumps(history, ensure_ascii=False)
|
||||||
yield cookies, chatbot_gr, json_history, msg
|
yield cookies, chatbot_gr, json_history, msg
|
||||||
|
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户