Skip to content

Commit 371680b

Browse files
authored
Fix empty system role replacement (#1526)
## PR Checklist - Required Checks - [ ] Have you added type definitions? - [x] Have you tested your changes? - [ ] Have you checked that it won't break any existing features? - [ ] If your PR uses models[^1], check the following: - [ ] Have you checked if it works normally in all models? - [ ] Have you checked if it works normally in all web, local, and node-hosted versions? If it doesn't, have you blocked it in those versions? - [x] If your PR is highly AI generated[^2], check the following: - [x] Have you understood what the code does? - [x] Have you cleaned up any unnecessary or redundant code? - [x] Is it not a huge change? - We currently do not accept highly AI generated PRs that are large changes. [^1]: Modifies the behavior of prompting, requesting, or handling responses from AI models. [^2]: Over 80% of the code is AI generated. ## Summary If `db.systemRoleReplacement` is blank, fallback to 'user' ## Related Issues If `db.systemRoleReplacement` is blank, request sends role with empty string. ## Changes If `db.systemRoleReplacement` is blank, fallback to 'user'
2 parents cfdedaa + 7c9220b commit 371680b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ts/process/request/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export function reformater(formated:OpenAIChat[],modelInfo:LLMModel|LLMFlags[]){
368368
for(let i=0;i<formated.length;i++){
369369
if(formated[i].role === 'system'){
370370
formated[i].content = db.systemContentReplacement ? db.systemContentReplacement.replace('{{slot}}', formated[i].content) : `system: ${formated[i].content}`
371-
formated[i].role = db.systemRoleReplacement
371+
formated[i].role = db.systemRoleReplacement || 'user'
372372
}
373373
}
374374
}

0 commit comments

Comments
 (0)