Removing post proceess of output
This commit is contained in:
parent
5f8e57d121
commit
7b3e0c1db2
10
llamabot.js
10
llamabot.js
@ -190,12 +190,10 @@ async function generateResponse(conversation) {
|
|||||||
console.log(JSON.stringify(responseData))
|
console.log(JSON.stringify(responseData))
|
||||||
const choice = responseData.choices[0];
|
const choice = responseData.choices[0];
|
||||||
|
|
||||||
// Remove "user None:" and any text after it from the response
|
const responseText = choice.message.content
|
||||||
const responseText = choice.message.content.trim();
|
|
||||||
const startIndex = responseText.indexOf('user None:');
|
return responseText;
|
||||||
const sanitizedResponse = startIndex === -1 ? responseText : responseText.substring(0, startIndex);
|
|
||||||
|
|
||||||
return sanitizedResponse;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user