From 54c597bb865aba15f16e0692c2f2119109d119aa Mon Sep 17 00:00:00 2001 From: srichman333 Date: Wed, 28 Feb 2024 19:24:22 -0500 Subject: chat with ai --- src/client/apis/gpt/GPT.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/client/apis/gpt/GPT.ts') diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts index 82436c42b..97a332294 100644 --- a/src/client/apis/gpt/GPT.ts +++ b/src/client/apis/gpt/GPT.ts @@ -33,7 +33,7 @@ const callTypeMap: { [type: string]: GPTCallOpts } = { * @param inputText Text to process * @returns AI Output */ -const gptAPICall = async (inputText: string, callType: GPTCallType) => { +const gptAPICall = async (inputText: string, callType: GPTCallType, prompt?: any) => { if (callType === GPTCallType.SUMMARY) inputText += '.'; const opts: GPTCallOpts = callTypeMap[callType]; try { @@ -43,8 +43,9 @@ const gptAPICall = async (inputText: string, callType: GPTCallType) => { }; const openai = new OpenAI(configuration); + let usePrompt = prompt? prompt: opts.prompt; let messages: ChatCompletionMessageParam[] = [ - { role: 'system', content: opts.prompt }, + { role: 'system', content: usePrompt }, { role: 'user', content: inputText }, ]; -- cgit v1.2.3-70-g09d2