Add basic claude support

This commit is contained in:
maver
2023-06-25 18:20:53 +02:00
parent c920b6c511
commit aaa2c48e7d
5 changed files with 80 additions and 60 deletions

View File

@ -61,6 +61,7 @@ export {
setOpenAIMessages,
setOpenAIMessageExamples,
setupOpenAIPromptManager,
setupClaudePromptManager,
generateOpenAIPromptCache,
prepareOpenAIMessages,
sendOpenAIRequest,
@ -278,9 +279,9 @@ function setOpenAIMessageExamples(mesExamplesArray) {
function setupOpenAIPromptManager(openAiSettings) {
promptManager = new PromptManager();
const configuration = {
prefix: 'openai_',
containerIdentifier: 'openai_prompt_manager',
listIdentifier: 'openai_prompt_manager_list',
prefix: 'completion_',
containerIdentifier: 'completion_prompt_manager',
listIdentifier: 'completion_prompt_manager_list',
toggleDisabled: ['main'],
draggable: true
};
@ -299,6 +300,10 @@ function setupOpenAIPromptManager(openAiSettings) {
promptManager.render();
}
function setupClaudePromptManager(claudeSettings) {
setupOpenAIPromptManager(claudeSettings);
}
function generateOpenAIPromptCache() {
openai_msgs = openai_msgs.reverse();
openai_msgs.forEach(function (msg, i, arr) {
@ -2086,6 +2091,7 @@ async function onModelChange() {
if ($(this).is('#model_claude_select')) {
console.log('Claude model changed to', value);
oai_settings.claude_model = value;
//setupOpenAIPromptManager(openai_settings);
}
if ($(this).is('#model_windowai_select')) {
@ -2096,6 +2102,7 @@ async function onModelChange() {
if ($(this).is('#model_openai_select')) {
console.log('OpenAI model changed to', value);
oai_settings.openai_model = value;
setupOpenAIPromptManager(openai_settings);
}
if ($(this).is('#model_openrouter_select')) {