mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-15 19:55:38 +02:00
Update groq.js
This commit is contained in:
parent
8a1a8ce370
commit
fb4b16e46c
1 changed files with 2 additions and 4 deletions
|
@ -52,7 +52,6 @@ export class GroqCloudAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the model name includes "deepseek-r1", handle the <think> tags
|
// If the model name includes "deepseek-r1", handle the <think> tags
|
||||||
if (this.model_name && this.model_name.toLowerCase().includes("deepseek-r1")) {
|
|
||||||
const hasOpenTag = res.includes("<think>");
|
const hasOpenTag = res.includes("<think>");
|
||||||
const hasCloseTag = res.includes("</think>");
|
const hasCloseTag = res.includes("</think>");
|
||||||
|
|
||||||
|
@ -68,7 +67,6 @@ export class GroqCloudAPI {
|
||||||
}
|
}
|
||||||
// Remove the complete <think> block (and any content inside) from the response
|
// Remove the complete <think> block (and any content inside) from the response
|
||||||
res = res.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
|
res = res.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
|
||||||
}
|
|
||||||
|
|
||||||
finalRes = res;
|
finalRes = res;
|
||||||
break; // Exit the loop once a valid response is obtained
|
break; // Exit the loop once a valid response is obtained
|
||||||
|
@ -76,7 +74,7 @@ export class GroqCloudAPI {
|
||||||
|
|
||||||
if (finalRes == null) {
|
if (finalRes == null) {
|
||||||
console.warn("Could not obtain a valid <think> block or normal response after max attempts.");
|
console.warn("Could not obtain a valid <think> block or normal response after max attempts.");
|
||||||
finalRes = "Response incomplete, please try again.";
|
finalRes = "I thought too hard, sorry, try again.";
|
||||||
}
|
}
|
||||||
finalRes = finalRes.replace(/<\|separator\|>/g, '*no response*');
|
finalRes = finalRes.replace(/<\|separator\|>/g, '*no response*');
|
||||||
|
|
||||||
|
@ -86,4 +84,4 @@ export class GroqCloudAPI {
|
||||||
async embed(text) {
|
async embed(text) {
|
||||||
console.log("There is no support for embeddings in Groq support. However, the following text was provided: " + text);
|
console.log("There is no support for embeddings in Groq support. However, the following text was provided: " + text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue