|
@@ -45,8 +45,9 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const sendMessage = async (text)=>{
|
|
const sendMessage = async (text)=>{
|
|
|
- let newTurn = {user_text: text};
|
|
|
|
|
|
|
+ let newTurn = {user_text: text, llm_text: ""};
|
|
|
turns.push(newTurn);
|
|
turns.push(newTurn);
|
|
|
|
|
+ streaming = true;
|
|
|
|
|
|
|
|
const response = await fetch(`${PUBLIC_API_URL}/game/${game.id}/session/${sessions[0].id}/turn`, {
|
|
const response = await fetch(`${PUBLIC_API_URL}/game/${game.id}/session/${sessions[0].id}/turn`, {
|
|
|
method: "POST",
|
|
method: "POST",
|
|
@@ -83,6 +84,15 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
streaming = false;
|
|
streaming = false;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const refreshRes = await fetch(`${PUBLIC_API_URL}/game/${game.id}`, { credentials: "include" });
|
|
|
|
|
+ if(refreshRes.ok){
|
|
|
|
|
+ const refreshData = await refreshRes.json();
|
|
|
|
|
+ turns = refreshData.data.turns;
|
|
|
|
|
+ tokensRemaining = refreshData.data.tokens_remaining;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMount(()=>{
|
|
onMount(()=>{
|