We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f2bfd1 commit 4983cffCopy full SHA for 4983cff
gemini-chat.html
@@ -49,7 +49,6 @@
49
userInput.value = "";
50
51
try {
52
- chatHistory.push({ role: "user", parts: [{ text: message }] });
53
const startTime = performance.now();
54
const result = await chat.sendMessageStream(message);
55
let fullResponse = "";
@@ -60,7 +59,11 @@
60
59
}
61
const endTime = performance.now();
62
const duration = ((endTime - startTime) / 1000).toFixed(2);
+
63
+ // Add the user's message and the model's response to chatHistory after the interaction
64
+ chatHistory.push({ role: "user", parts: [{ text: message }] });
65
chatHistory.push({ role: "model", parts: [{ text: fullResponse }] });
66
67
let usage = (await result.response).usageMetadata;
68
console.log("Full result:", result);
69
updateUsageMetadata(usage);
0 commit comments