Search working!!!

This commit is contained in:
2024-07-30 14:59:10 +08:00
parent 4627da2efb
commit a18b12c725
4 changed files with 112 additions and 29 deletions

View File

@@ -1,11 +1,11 @@
const OpenAI = require("openai");
const { getApiKey } = require("./apiKey");
async function openAiChatCompletion(query) {
async function openAiChatCompletion(query, systemPrompt) {
const openai = new OpenAI({ apiKey: await getApiKey("openai_api_key") });
const completion = await openai.chat.completions.create({
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "system", content: systemPrompt },
{ role: "user", content: query },
],
model: "gpt-4o-mini",