Spaces:
Runtime error
Runtime error
Commit
·
010afb3
1
Parent(s):
673e438
fix to try again when llama2 fail
Browse files- src/app/main.tsx +13 -8
src/app/main.tsx
CHANGED
@@ -307,16 +307,21 @@ export default function Main() {
|
|
307 |
let newDialogue = ""
|
308 |
try {
|
309 |
newDialogue = await getDialogue({ game, situation, userAction })
|
310 |
-
|
311 |
-
// try to remove whatever hallucination might come up next
|
312 |
-
newDialogue = newDialogue.split("As the player")[0]
|
313 |
-
newDialogue = newDialogue.split("As they use")[0]
|
314 |
-
|
315 |
-
setDialogue(newDialogue)
|
316 |
} catch (err) {
|
317 |
-
console.log(`failed to generate
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
}
|
|
|
|
|
|
|
|
|
|
|
320 |
})
|
321 |
}
|
322 |
|
|
|
307 |
let newDialogue = ""
|
308 |
try {
|
309 |
newDialogue = await getDialogue({ game, situation, userAction })
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
} catch (err) {
|
311 |
+
console.log(`failed to generate dialoguee, let's try again maybe`)
|
312 |
+
try {
|
313 |
+
newDialogue = await getDialogue({ game, situation, userAction: `${userAction}.` })
|
314 |
+
} catch (err) {
|
315 |
+
console.log(`failed to generate dialogue.. again (but it's only a nice to have, so..)`)
|
316 |
+
setDialogue("")
|
317 |
+
return
|
318 |
+
}
|
319 |
}
|
320 |
+
|
321 |
+
// try to remove whatever hallucination might come up next
|
322 |
+
newDialogue = newDialogue.split("As the player")[0]
|
323 |
+
newDialogue = newDialogue.split("As they use")[0]
|
324 |
+
setDialogue(newDialogue)
|
325 |
})
|
326 |
}
|
327 |
|