An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Customize ChatGPT model
winniesi4b2c4e448122
diff --git a/.env.local.example b/.env.local.exampleindex ef0ba07f..907a35bd 100644--- a/.env.local.example+++ b/.env.local.example@@ -2,6 +2,10 @@# If you need to set a BASE URL, uncomment and set the following:# OPENAI_API_BASE=+# Used to set the model for OpenAI API requests.+# If not set, the default is gpt-4-turbo.+# OPENAI_API_MODEL='gpt-4-turbo'+# OpenAI API key retrieved here: https://platform.openai.com/api-keysOPENAI_API_KEY=diff --git a/README.md b/README.mdindex d2166fdd..63faebaa 100644--- a/README.md+++ b/README.md@@ -50,6 +50,10 @@ Your .env.local file should look like this:# If you need to set a BASE URL, uncomment and set the following:# OPENAI_API_BASE=+# Used to set the model for OpenAI API requests.+# If not set, the default is gpt-4-turbo.+# OPENAI_API_MODEL='gpt-4-turbo'+# OpenAI API key retrieved here: https://platform.openai.com/api-keysOPENAI_API_KEY=[YOUR_OPENAI_API_KEY]diff --git a/lib/agents/inquire.tsx b/lib/agents/inquire.tsxindex 1d7b3710..122acd04 100644--- a/lib/agents/inquire.tsx+++ b/lib/agents/inquire.tsx@@ -18,7 +18,7 @@ export async function inquire(let finalInquiry: PartialInquiry = {}await experimental_streamObject({- model: openai.chat('gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),system: `As a professional web researcher, your role is to deepen your understanding of the user's input by conducting further inquiries when necessary.After receiving an initial response from the user, carefully assess whether additional questions are absolutely essential to provide a comprehensive and accurate answer. Only proceed with further inquiries if the available information is insufficient or ambiguous.diff --git a/lib/agents/query-suggestor.tsx b/lib/agents/query-suggestor.tsxindex f79313a1..bd41b387 100644--- a/lib/agents/query-suggestor.tsx+++ b/lib/agents/query-suggestor.tsx@@ -22,7 +22,7 @@ export async function querySuggestor()await experimental_streamObject({- model: openai.chat('gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),system: `As a professional web researcher, your task is to generate a set of three queries that explore the subject matter more deeply, building upon the initial query and the information uncovered in its search results.For instance, if the original query was "Starship's third test flight key milestones", your output should follow this format:diff --git a/lib/agents/researcher.tsx b/lib/agents/researcher.tsxindex 7cfa035d..286790a8 100644--- a/lib/agents/researcher.tsx+++ b/lib/agents/researcher.tsx@@ -38,7 +38,7 @@ export async function researcher()const result = await experimental_streamText({- model: openai.chat('gpt-4-turbo'),+ model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),maxTokens: 2500,system: `As a professional search expert, you possess the ability to search for any information on the web.For each user query, utilize the search results to their fullest potential to provide additional information and assistance in your response.