Enable Smart Context (ChromaDB) support within OpenAI API (#1125)

* Add JetBrains IDE .idea folder to .gitignore

* Enable Smart Context (ChromaDB) support within OpenAI API
This commit is contained in:
Jason Wu 2023-09-13 18:01:56 +08:00 committed by GitHub
parent e74090139c
commit 7a3869c476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ public/settings.json
/thumbnails
whitelist.txt
.vscode
.idea/
secrets.json
/dist
/backups/

View File

@ -636,6 +636,11 @@ function populateChatCompletion(prompts, chatCompletion, { bias, quietPrompt, ty
chatCompletion.insert(vectorsMemory, 'main');
}
// Smart Context (ChromaDB)
if (prompts.has('smartContext')) {
chatCompletion.insert(Message.fromPrompt(prompts.get('smartContext')), 'main');
}
// Decide whether dialogue examples should always be added
if (power_user.pin_examples) {
populateDialogueExamples(prompts, chatCompletion);
@ -711,6 +716,14 @@ function preparePromptsForChatCompletion({Scenario, charPersonality, name2, worl
identifier: 'vectorsMemory',
});
// Smart Context (ChromaDB)
const smartContext = extensionPrompts['chromadb'];
if (smartContext && smartContext.value) systemPrompts.push({
role: 'system',
content: smartContext.value,
identifier: 'smartContext'
});
// Persona Description
if (power_user.persona_description && power_user.persona_description_position === persona_description_positions.IN_PROMPT) {
systemPrompts.push({ role: 'system', content: power_user.persona_description, identifier: 'personaDescription' });