From f4eea91a64b2a188596158e54fae1d53a58eddd6 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:13:12 +0800 Subject: [PATCH 01/23] .env --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 2573a0f6..77ed3ad8 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # Your API Key for GEMINI_API -GEMINI_API_KEY= +GEMINI_API_KEY=AIzaSyCtrmT3JUvtG6SkYSPSa8w67Fta6yXf1U0 # Custom base url for OpenAI API. default: https://generativelanguage.googleapis.com API_BASE_URL= # Inject analytics or other scripts before of the page From 22867e3de55d63f71c93ebd3ff1a8cc8abfd94a8 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:22:58 +0800 Subject: [PATCH 02/23] Rename .env.example to .env --- .env.example => .env | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .env.example => .env (100%) diff --git a/.env.example b/.env similarity index 100% rename from .env.example rename to .env From a61acb484bab6bf59e4c185c96b4dc3e1a88f0fd Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 16 Jan 2024 15:52:31 +0800 Subject: [PATCH 03/23] Header.astro --- src/components/Header.astro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index 36e30df3..1f4f693e 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -9,12 +9,12 @@ import Themetoggle from './Themetoggle.astro'
- Gemini Pro - Chat + Gemini Pro + Chat

Based on - Gemini Pro API. - Source code + Gemini Pro API. + Source code

From d2f72d131d86e36ff15b49c0467e45b3ee157f7d Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 16 Jan 2024 15:54:44 +0800 Subject: [PATCH 04/23] Footer.astro --- src/components/Footer.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Footer.astro b/src/components/Footer.astro index edd457e8..262af0d8 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -24,7 +24,7 @@

- © 2023 Gemini Pro Chat. All rights reserved. + © 2023 Gemini Pro Chat. All rights reserved.

From 20e29d593c0ff8bd1c11f3e814ad93f766c2cf1e Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Sat, 12 Oct 2024 00:38:46 +0800 Subject: [PATCH 05/23] Footer.astro --- src/components/Footer.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 262af0d8..fad12d24 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -24,7 +24,7 @@

- © 2023 Gemini Pro Chat. All rights reserved. + © 2023 Gemini Pro Chat. All rights reserved.

From bca6c2d51c9af781184649cb901b58587ffe0f2f Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Sat, 12 Oct 2024 00:41:10 +0800 Subject: [PATCH 06/23] Header.astro --- src/components/Header.astro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index 1f4f693e..b1456917 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -9,12 +9,12 @@ import Themetoggle from './Themetoggle.astro'
- Gemini Pro - Chat + Gemini Pro + Chat

Based on - Gemini Pro API. - Source code + Gemini Pro API. + Source code

From 8336e7c21318839e6aa52cbf8ee1d81f6f59b1f0 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:12:41 +0800 Subject: [PATCH 07/23] Header.astro --- src/components/Header.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index b1456917..8c251680 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -14,7 +14,7 @@ import Themetoggle from './Themetoggle.astro'

Based on - Gemini Pro API. - Source code + EASY AI. + Developer Adonis

From 49210f1f012644ad5ae0b30ace894c7a45354510 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:13:38 +0800 Subject: [PATCH 08/23] Header.astro --- src/components/Header.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index 8c251680..e40f4276 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -9,7 +9,7 @@ import Themetoggle from './Themetoggle.astro'

From 117d7c8fe1b9bf17da5268956cd55c8b53791918 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:25:09 +0800 Subject: [PATCH 09/23] openAI.ts --- src/utils/openAI.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index b5afc7f1..7a466c8f 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -9,7 +9,12 @@ const genAI = apiBaseUrl export const startChatAndSendMessageStream = async(history: ChatMessage[], newMessage: string) => { const model = genAI.getGenerativeModel({ model: 'gemini-pro' }) - + if (history.length === 0) { + history.push({ + role: 'system', + parts: [{ text: 'You are EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself.' }] + }) + } const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From b480e2bef38a329c54cdfeacf4ef6e8c9bfda8fd Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:26:15 +0800 Subject: [PATCH 10/23] openAI.ts --- src/utils/openAI.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index 7a466c8f..ad2f2728 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -15,6 +15,7 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe parts: [{ text: 'You are EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself.' }] }) } + // const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From e511b50ebb45d661c65611f25b6a786b2c6e2e65 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:29:40 +0800 Subject: [PATCH 11/23] openAI.ts --- src/utils/openAI.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index ad2f2728..a34512f7 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -9,13 +9,7 @@ const genAI = apiBaseUrl export const startChatAndSendMessageStream = async(history: ChatMessage[], newMessage: string) => { const model = genAI.getGenerativeModel({ model: 'gemini-pro' }) - if (history.length === 0) { - history.push({ - role: 'system', - parts: [{ text: 'You are EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself.' }] - }) - } - // + const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From 4e8d713352a62b722040221e940fe28bce4a790c Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:32:21 +0800 Subject: [PATCH 12/23] openAI.ts --- src/utils/openAI.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index a34512f7..d5b49dd3 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -9,7 +9,15 @@ const genAI = apiBaseUrl export const startChatAndSendMessageStream = async(history: ChatMessage[], newMessage: string) => { const model = genAI.getGenerativeModel({ model: 'gemini-pro' }) - + + // Check if the chat history is empty, indicating this is the user's first interaction + if (history.length === 0) { + history.push({ + role: 'system', + parts: [{ text: 'You are EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself.' }] + }) + } + const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From fa4f6b52842b8613c877448ec2810e288fb752d6 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:34:00 +0800 Subject: [PATCH 13/23] openAI.ts --- src/utils/openAI.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index d5b49dd3..75de82f8 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -11,12 +11,7 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe const model = genAI.getGenerativeModel({ model: 'gemini-pro' }) // Check if the chat history is empty, indicating this is the user's first interaction - if (history.length === 0) { - history.push({ - role: 'system', - parts: [{ text: 'You are EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself.' }] - }) - } + const chat = model.startChat({ history: history.map(msg => ({ From 42dcac2049f9796b92f1eb2ab8ec3789fcb903bd Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:38:08 +0800 Subject: [PATCH 14/23] openAI.ts --- src/utils/openAI.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index 75de82f8..e57309df 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -12,7 +12,12 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe // Check if the chat history is empty, indicating this is the user's first interaction - + if (history.length === 0) { + history.push({ + role: 'Assistant', + parts: [{"content":: " I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself." }] + }) + } const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From 7b8ce21e0efb3ca159bebc24197cda23c7f076fd Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:38:41 +0800 Subject: [PATCH 15/23] openAI.ts --- src/utils/openAI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index e57309df..b65db80f 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -15,7 +15,7 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe if (history.length === 0) { history.push({ role: 'Assistant', - parts: [{"content":: " I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself." }] + parts: [{"content": " I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself." }] }) } const chat = model.startChat({ From daa0880fc7821c04c47c8e7f97b6d6aa22d01729 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:42:51 +0800 Subject: [PATCH 16/23] openAI.ts --- src/utils/openAI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index b65db80f..6c8b0884 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -14,7 +14,7 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe if (history.length === 0) { history.push({ - role: 'Assistant', + role: 'assistant', parts: [{"content": " I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself." }] }) } From bb1012922214a9bf588dce1c25ebe706f9d5fc06 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:45:26 +0800 Subject: [PATCH 17/23] openAI.ts --- src/utils/openAI.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index 6c8b0884..75de82f8 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -12,12 +12,7 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe // Check if the chat history is empty, indicating this is the user's first interaction - if (history.length === 0) { - history.push({ - role: 'assistant', - parts: [{"content": " I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself." }] - }) - } + const chat = model.startChat({ history: history.map(msg => ({ role: msg.role, From 091b2f45a49c716a709b42172a0ece544c9303eb Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:03:49 +0800 Subject: [PATCH 18/23] types.ts --- src/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types.ts b/src/types.ts index dbea4ce3..8048b436 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,4 @@ + export interface ChatPart { text: string } @@ -11,3 +12,4 @@ export interface ErrorMessage { code: string message: string } +const defaultChatMessage = "I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself."; From a71098c6aeadad9bb7327e439e4a5a9dfaef9d01 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:04:15 +0800 Subject: [PATCH 19/23] openAI.ts --- src/utils/openAI.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/openAI.ts b/src/utils/openAI.ts index 75de82f8..eca3185e 100644 --- a/src/utils/openAI.ts +++ b/src/utils/openAI.ts @@ -1,4 +1,5 @@ import { GoogleGenerativeAI } from '@fuyun/generative-ai' +import { defaultChatMessage } from '../types' // Import the default chat message const apiKey = (import.meta.env.GEMINI_API_KEY) const apiBaseUrl = (import.meta.env.API_BASE_URL)?.trim().replace(/\/$/, '') @@ -11,7 +12,12 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe const model = genAI.getGenerativeModel({ model: 'gemini-pro' }) // Check if the chat history is empty, indicating this is the user's first interaction - + if (history.length === 0) { + history.push({ + role: 'model', + parts: [{ text: defaultChatMessage }] // Use default chat message if history is empty + }); + } const chat = model.startChat({ history: history.map(msg => ({ From d1aee86966eaa1ce75eaa05a58c7a8c37a5e3b49 Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:05:43 +0800 Subject: [PATCH 20/23] types.ts --- src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index 8048b436..2db4e3c1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,4 +12,4 @@ export interface ErrorMessage { code: string message: string } -const defaultChatMessage = "I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself."; +export const defaultChatMessage = "I'm EASY AI developed by ADONIS JR S under EASY API headed by Adonis himself."; From 8180b6132a069efaed170cc758aad921e7cf752e Mon Sep 17 00:00:00 2001 From: Adonis <75648240+Bucky-26@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:11:07 +0800 Subject: [PATCH 21/23] SystemRoleSettings.tsx --- src/components/SystemRoleSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SystemRoleSettings.tsx b/src/components/SystemRoleSettings.tsx index c109015d..3ac06cbb 100644 --- a/src/components/SystemRoleSettings.tsx +++ b/src/components/SystemRoleSettings.tsx @@ -59,7 +59,7 @@ export default (props: Props) => {