Skip to content

Commit

Permalink
Fix webassembly error, can't have Wasm INSIDE of Wasm. Noted.
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Jul 1, 2024
1 parent 2274865 commit 80d81e9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/utils/modelProviders/WebLLM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@ export default class ChatUI {
// Assistant...

// Call build prompt here.
const engineeredConvo = await buildPrompt({
conversation,
projectName,
courseMetadata: undefined,
})

// Then build the messagesToSend array.... update system message every time.
messagesToSend.push({
Expand All @@ -177,8 +172,13 @@ export default class ChatUI {
conversation.messages[conversation.messages.length - 1]
?.latestSystemMessage!,
})
// Push everything except that last user message...
// Use the engineered version of the last user message.

conversation.messages.forEach((message: any, index: number) => {
// Skip the final iteration
if (index === conversation.messages.length - 1) return

engineeredConvo.messages.forEach((message: any) => {
// TODO: Are we sending system message twice?
if (typeof message.content === 'string') {
messagesToSend.push({
Expand All @@ -192,7 +192,14 @@ export default class ChatUI {
})
}
})

// TODO: last user message needs to be the engineered version, too.
messagesToSend.push({
role: 'user',
content:
conversation.messages[conversation.messages.length - 1]
?.finalPromtEngineeredMessage!,
})

console.log('CHECK ME Messages to send', messagesToSend)

Expand Down

0 comments on commit 80d81e9

Please sign in to comment.