From c8c1e4bb73f0d3dcfd99ca39a4bfe10b94452718 Mon Sep 17 00:00:00 2001 From: srijna Date: Thu, 8 Jan 2026 21:56:14 +0530 Subject: [PATCH 1/7] feature added a similler input box ton enter gemini model like grok model input box --- settings/settings.ts | 42 +++++++++++++++++++++++++++++++----------- utils/GeminiModel.ts | 39 ++++++++++++++++++++++++++------------- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/settings/settings.ts b/settings/settings.ts index be7401f..d6d23e1 100644 --- a/settings/settings.ts +++ b/settings/settings.ts @@ -5,18 +5,25 @@ import { export enum SettingEnum { ID_LLM_PROVIDER = `llm-provider`, + ID_GROQ_API_KEY = `groq-model`, ID_GROQ_MODEL = `groq-api-key`, + + ID_GEMINI_MODEL = `gemini-model`, ID_GEMINI_API_KEY = `gemini-api-key`, + + ID_RC_MODEL = `rc-model`, ID_RC_AUTH_TOKEN = `rc-auth-token`, ID_RC_USER_ID = `rc-user-id`, + KEY_GROQ = `groq`, KEY_GEMINI = `gemini`, KEY_RC = `rocketchat`, } + export const settings: ISetting[] = [ { id: SettingEnum.ID_LLM_PROVIDER, @@ -50,6 +57,19 @@ export const settings: ISetting[] = [ i18nLabel: "Groq API Key (required for Groqcloud)", i18nPlaceholder: "Groq API Key", }, + + + { + id: SettingEnum.ID_GEMINI_MODEL, + type: SettingType.STRING, + packageValue: "", + required: false, + public: false, + i18nLabel: "Gemini Model (required for Google AI Studio)", + i18nPlaceholder: "e.g. gemini-2.5-flash, gemini-1.5-pro", + }, + + { id: SettingEnum.ID_GEMINI_API_KEY, type: SettingType.PASSWORD, @@ -74,21 +94,21 @@ export const settings: ISetting[] = [ }, { id: SettingEnum.ID_RC_AUTH_TOKEN, - i18nLabel: - "Personal Access Token (required for In House (Rocket Chat))", + i18nLabel: "Personal Access Token (required for In House (Rocket Chat))", i18nDescription: "Must be filled to enable file summary add-on", type: SettingType.PASSWORD, required: false, public: false, packageValue: "", }, - { - id: SettingEnum.ID_RC_USER_ID, - i18nLabel: "User ID (required for In House (Rocket Chat))", - i18nDescription: "Must be filled to enable file summary add-on", - type: SettingType.STRING, - required: false, - public: false, - packageValue: "", - }, + { + id: SettingEnum.ID_RC_USER_ID, + i18nLabel: "User ID (required for In House (Rocket Chat))", + i18nDescription: "Must be filled to enable file summary add-on", + type: SettingType.STRING, + required: false, + public: false, + packageValue: "", + }, + ]; diff --git a/utils/GeminiModel.ts b/utils/GeminiModel.ts index 4feafb2..07f5c24 100644 --- a/utils/GeminiModel.ts +++ b/utils/GeminiModel.ts @@ -15,32 +15,45 @@ export async function createTextCompletionGemini( throw new Error("geminiApiKey not configured."); } - const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=${geminiApiKey}`; + const geminiModel = await read + .getEnvironmentReader() + .getSettings() + .getValueById(SettingEnum.ID_GEMINI_MODEL); + + if (!geminiModel) { + throw new Error("geminiModel not configured."); + } + + const url = `https://generativelanguage.googleapis.com/v1beta/models/${geminiModel}:generateContent?key=${geminiApiKey}`; const body = { contents: [{ parts: [{ text: prompt }] }], }; const response = await http.post(url, { - headers: { "Content-Type": "application/json" }, + headers: { + "Content-Type": "application/json", + }, content: JSON.stringify(body), }); if (response.statusCode !== 200 || !response.content) { - return JSON.stringify({ - message: - "Sorry! I was unable to process your request. Please try again.", - }); + throw new Error( + "Sorry! I was unable to process your request. Please try again." + ); } - let text = JSON.parse(response.content)?.candidates?.[0]?.content - ?.parts?.[0]?.text; + let text = + JSON.parse(response.content)?.candidates?.[0]?.content?.parts?.[0] + ?.text; + + if (!text) { + throw new Error("Empty response from Gemini"); + } - // Clean up the response if it's wrapped in markdown code blocks - if (text.startsWith("```json") && text.endsWith("```")) { - text = text.slice(7, -3).trim(); // Remove ```json and ``` - } else if (text.startsWith("```") && text.endsWith("```")) { - text = text.slice(3, -3).trim(); // Remove ``` and ``` + // Remove markdown wrappers if present + if (text.startsWith("```") && text.endsWith("```")) { + text = text.replace(/^```[a-z]*\n?|```$/g, "").trim(); } return text; From c9225d5b36bc4b662840a36e655bade4921ecdd6 Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 00:13:37 +0530 Subject: [PATCH 2/7] fixed bug swapped api key and model --- utils/GroqModels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/GroqModels.ts b/utils/GroqModels.ts index 17056e1..6b97704 100644 --- a/utils/GroqModels.ts +++ b/utils/GroqModels.ts @@ -27,7 +27,7 @@ export async function createTextCompletionGroq( } const body = { - groqModel, + model:groqModel, messages: [ { role: "system", From f31649c4583249e68778ebdd1f0f20323d24f03b Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 17:57:18 +0530 Subject: [PATCH 3/7] made a templet for issue and pr --- .github/ISSUE_TEMPLATE/bug.md | 24 ++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature.md | 18 ++++++++++++++++++ .github/pull_request_template.md | 16 ++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.md create mode 100644 .github/ISSUE_TEMPLATE/feature.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000..faaf9ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,24 @@ +--- +name: Bug +about: Create a report to help us improve +labels: bug +--- + +### Description: + + + +### Steps to reproduce: + +1. +2. +3. + +### Expected behavior: + + + +### Actual behavior: + + + diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 0000000..ad5aba8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,18 @@ +--- +name: Feature +about: Create a feature request +labels: enhancement +--- + +As a AI Chat Workflows Automation developer + +**I need to**: + +**So That**: + +**Acceptance Criteria** + +- [ ] TODO 1 +- [ ] TODO 2 +- [ ] TODO 3 + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..ccb4481 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +# Brief Title + +## Acceptance Criteria fulfillment + +- [ ] Task 1 +- [ ] Task 2 +- [ ] Task 3 + +Fixes # (issue) + +## Video/Screenshots + +## PR Test Details + +**Note**: The PR will be ready for live testing after approval. Please test the changes by deploying the app using `rc-apps deploy` to your test Rocket.Chat instance. + From 8e695de65eddd7dac30df2384176c7ac01046584 Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 18:14:56 +0530 Subject: [PATCH 4/7] Revert "made a templet for issue and pr" This reverts commit f31649c4583249e68778ebdd1f0f20323d24f03b. --- .github/ISSUE_TEMPLATE/bug.md | 24 ------------------------ .github/ISSUE_TEMPLATE/feature.md | 18 ------------------ .github/pull_request_template.md | 16 ---------------- 3 files changed, 58 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug.md delete mode 100644 .github/ISSUE_TEMPLATE/feature.md delete mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md deleted file mode 100644 index faaf9ef..0000000 --- a/.github/ISSUE_TEMPLATE/bug.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: Bug -about: Create a report to help us improve -labels: bug ---- - -### Description: - - - -### Steps to reproduce: - -1. -2. -3. - -### Expected behavior: - - - -### Actual behavior: - - - diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md deleted file mode 100644 index ad5aba8..0000000 --- a/.github/ISSUE_TEMPLATE/feature.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Feature -about: Create a feature request -labels: enhancement ---- - -As a AI Chat Workflows Automation developer - -**I need to**: - -**So That**: - -**Acceptance Criteria** - -- [ ] TODO 1 -- [ ] TODO 2 -- [ ] TODO 3 - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index ccb4481..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -# Brief Title - -## Acceptance Criteria fulfillment - -- [ ] Task 1 -- [ ] Task 2 -- [ ] Task 3 - -Fixes # (issue) - -## Video/Screenshots - -## PR Test Details - -**Note**: The PR will be ready for live testing after approval. Please test the changes by deploying the app using `rc-apps deploy` to your test Rocket.Chat instance. - From f21f45350e772a322495fc6e390bc4693a16010d Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 18:23:19 +0530 Subject: [PATCH 5/7] made a templet for issue and pr --- .github/ISSUE_TEMPLATE/bug.md | 23 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature.md | 18 ++++++++++++++++++ .github/pull_request_template.md | 15 +++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.md create mode 100644 .github/ISSUE_TEMPLATE/feature.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000..1f0fddb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,23 @@ +--- +name: Bug +about: Create a report to help us improve +labels: bug +--- + +### Description: + + + +### Steps to reproduce: + +1. +2. +3. + +### Expected behavior: + + + +### Actual behavior: + + diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 0000000..d31d5ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,18 @@ +--- +name: Feature +about: Create a feature request +labels: enhancement +--- + +As a developer + +**I need to**: + +**So That**: + +**Acceptance Criteria** + +- [ ] TODO 1 +- [ ] TODO 2 +- [ ] TODO 3 + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..cdfb8c3 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +### Brief Title + +### Acceptance Criteria fulfillment + +- [ ] Task 1 +- [ ] Task 2 +- [ ] Task 3 + +Fixes # (issue) + +### Video/Screenshots + +### PR Test Details + + From 5c436bf1047038d5e95897be8aacd4b02a8d38e3 Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 18:29:43 +0530 Subject: [PATCH 6/7] Revert "feature added a similler input box ton enter gemini model like grok model input box" This reverts commit c8c1e4bb73f0d3dcfd99ca39a4bfe10b94452718. --- settings/settings.ts | 42 +++++++++++------------------------------- utils/GeminiModel.ts | 39 +++++++++++++-------------------------- 2 files changed, 24 insertions(+), 57 deletions(-) diff --git a/settings/settings.ts b/settings/settings.ts index d6d23e1..be7401f 100644 --- a/settings/settings.ts +++ b/settings/settings.ts @@ -5,25 +5,18 @@ import { export enum SettingEnum { ID_LLM_PROVIDER = `llm-provider`, - ID_GROQ_API_KEY = `groq-model`, ID_GROQ_MODEL = `groq-api-key`, - - ID_GEMINI_MODEL = `gemini-model`, ID_GEMINI_API_KEY = `gemini-api-key`, - - ID_RC_MODEL = `rc-model`, ID_RC_AUTH_TOKEN = `rc-auth-token`, ID_RC_USER_ID = `rc-user-id`, - KEY_GROQ = `groq`, KEY_GEMINI = `gemini`, KEY_RC = `rocketchat`, } - export const settings: ISetting[] = [ { id: SettingEnum.ID_LLM_PROVIDER, @@ -57,19 +50,6 @@ export const settings: ISetting[] = [ i18nLabel: "Groq API Key (required for Groqcloud)", i18nPlaceholder: "Groq API Key", }, - - - { - id: SettingEnum.ID_GEMINI_MODEL, - type: SettingType.STRING, - packageValue: "", - required: false, - public: false, - i18nLabel: "Gemini Model (required for Google AI Studio)", - i18nPlaceholder: "e.g. gemini-2.5-flash, gemini-1.5-pro", - }, - - { id: SettingEnum.ID_GEMINI_API_KEY, type: SettingType.PASSWORD, @@ -94,21 +74,21 @@ export const settings: ISetting[] = [ }, { id: SettingEnum.ID_RC_AUTH_TOKEN, - i18nLabel: "Personal Access Token (required for In House (Rocket Chat))", + i18nLabel: + "Personal Access Token (required for In House (Rocket Chat))", i18nDescription: "Must be filled to enable file summary add-on", type: SettingType.PASSWORD, required: false, public: false, packageValue: "", }, - { - id: SettingEnum.ID_RC_USER_ID, - i18nLabel: "User ID (required for In House (Rocket Chat))", - i18nDescription: "Must be filled to enable file summary add-on", - type: SettingType.STRING, - required: false, - public: false, - packageValue: "", - }, - + { + id: SettingEnum.ID_RC_USER_ID, + i18nLabel: "User ID (required for In House (Rocket Chat))", + i18nDescription: "Must be filled to enable file summary add-on", + type: SettingType.STRING, + required: false, + public: false, + packageValue: "", + }, ]; diff --git a/utils/GeminiModel.ts b/utils/GeminiModel.ts index 07f5c24..4feafb2 100644 --- a/utils/GeminiModel.ts +++ b/utils/GeminiModel.ts @@ -15,45 +15,32 @@ export async function createTextCompletionGemini( throw new Error("geminiApiKey not configured."); } - const geminiModel = await read - .getEnvironmentReader() - .getSettings() - .getValueById(SettingEnum.ID_GEMINI_MODEL); - - if (!geminiModel) { - throw new Error("geminiModel not configured."); - } - - const url = `https://generativelanguage.googleapis.com/v1beta/models/${geminiModel}:generateContent?key=${geminiApiKey}`; + const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=${geminiApiKey}`; const body = { contents: [{ parts: [{ text: prompt }] }], }; const response = await http.post(url, { - headers: { - "Content-Type": "application/json", - }, + headers: { "Content-Type": "application/json" }, content: JSON.stringify(body), }); if (response.statusCode !== 200 || !response.content) { - throw new Error( - "Sorry! I was unable to process your request. Please try again." - ); + return JSON.stringify({ + message: + "Sorry! I was unable to process your request. Please try again.", + }); } - let text = - JSON.parse(response.content)?.candidates?.[0]?.content?.parts?.[0] - ?.text; - - if (!text) { - throw new Error("Empty response from Gemini"); - } + let text = JSON.parse(response.content)?.candidates?.[0]?.content + ?.parts?.[0]?.text; - // Remove markdown wrappers if present - if (text.startsWith("```") && text.endsWith("```")) { - text = text.replace(/^```[a-z]*\n?|```$/g, "").trim(); + // Clean up the response if it's wrapped in markdown code blocks + if (text.startsWith("```json") && text.endsWith("```")) { + text = text.slice(7, -3).trim(); // Remove ```json and ``` + } else if (text.startsWith("```") && text.endsWith("```")) { + text = text.slice(3, -3).trim(); // Remove ``` and ``` } return text; From ff225e76425a8dd6e917bf171a51fb0cfbe503c0 Mon Sep 17 00:00:00 2001 From: srijna Date: Fri, 9 Jan 2026 18:29:46 +0530 Subject: [PATCH 7/7] Revert "fixed bug swapped api key and model" This reverts commit c9225d5b36bc4b662840a36e655bade4921ecdd6. --- utils/GroqModels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/GroqModels.ts b/utils/GroqModels.ts index 6b97704..17056e1 100644 --- a/utils/GroqModels.ts +++ b/utils/GroqModels.ts @@ -27,7 +27,7 @@ export async function createTextCompletionGroq( } const body = { - model:groqModel, + groqModel, messages: [ { role: "system",