Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ const Popup: React.FC = () => {
<HideApiKey
value={apikey || ''}
onChange={(e) => setApikey(e.target.value)}
placeholder="Enter OpenAI API Key"
placeholder={`${['gemini_1.5_pro'].includes(selectedModel as string) ? 'Enter Gemini API key' : 'Enter OpenAI API Key'}`}
disabled={!model}
required
/>
</div>
<Button disabled={isloading} type="submit" className="w-full mt-2">
save API Key
Save Api Key
</Button>
</form>
{submitMessage ? (
Expand Down
12 changes: 6 additions & 6 deletions src/modals/BaseModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ import {
GenerateResponseParamsType,
GenerateResponseReturnType,
ModalInterface,
} from '../interface/ModalInterface'
} from '@/interface/ModalInterface'

/**
* Abstract base class for modals that interact with an API.
* This class is the base class for all modals.
* It implements the interface defined above.
* It provides a base implementation for the `generateResponse` method.
* It also defines an abstract method that must be implemented by all subclasses.
*
*
* @abstract
* @extends {ModalInterface}
*/
export abstract class BaseModal extends ModalInterface {
/**
* The API key used for making API calls.
*
*
* @protected
* @type {string}
*/
protected apiKey: string = ''

/**
* Initializes the modal with the provided API key.
*
*
* @param {string} apiKey - The API key to be used for API calls.
*/
init(apiKey: string) {
Expand All @@ -34,7 +34,7 @@ export abstract class BaseModal extends ModalInterface {

/**
* Makes an API call with the provided parameters.
*
*
* @protected
* @abstract
* @param {GenerateResponseParamsType} props - The parameters for the API call.
Expand All @@ -46,7 +46,7 @@ export abstract class BaseModal extends ModalInterface {

/**
* Generates a response by making an API call with the provided parameters.
*
*
* @async
* @param {GenerateResponseParamsType} props - The parameters for the API call.
* @returns {Promise<GenerateResponseReturnType>} The response from the API call.
Expand Down
6 changes: 3 additions & 3 deletions src/modals/modal/GeminiAI_1_5_pro.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createGoogleGenerativeAI } from '@ai-sdk/google'
import { VALID_MODELS } from '@/constants/valid_modals'
import {
GenerateResponseParamsType,
GenerateResponseReturnType,
ModalInterface,
} from '../../interface/ModalInterface'
import { createGoogleGenerativeAI } from '@ai-sdk/google'
} from '@/interface/ModalInterface'
import { generateObjectResponce } from '../utils'
import { VALID_MODELS } from '@/constants/valid_modals'

export class GeminiAI_1_5_pro implements ModalInterface {
name = 'gemini_1.5_pro'
Expand Down
8 changes: 4 additions & 4 deletions src/modals/modal/OpenAI_3_5_turbo.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createOpenAI } from '@ai-sdk/openai'
import { generateObjectResponce } from '../utils'
import { VALID_MODELS } from '@/constants/valid_modals'
import {
GenerateResponseParamsType,
GenerateResponseReturnType,
ModalInterface,
} from '../../interface/ModalInterface'
import { createOpenAI } from '@ai-sdk/openai'
import { generateObjectResponce } from '../utils'
import { VALID_MODELS } from '@/constants/valid_modals'
} from '@/interface/ModalInterface'

export class OpenAI_3_5_turbo implements ModalInterface {
name = 'openai_3.5_turbo'
Expand Down
8 changes: 4 additions & 4 deletions src/modals/modal/OpenAI_40.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createOpenAI } from '@ai-sdk/openai'
import { generateObjectResponce } from '../utils'
import { VALID_MODELS } from '@/constants/valid_modals'
import {
GenerateResponseParamsType,
GenerateResponseReturnType,
ModalInterface,
} from '../../interface/ModalInterface'
import { createOpenAI } from '@ai-sdk/openai'
import { generateObjectResponce } from '../utils'
import { VALID_MODELS } from '@/constants/valid_modals'
} from '@/interface/ModalInterface'

export class OpenAi_4o implements ModalInterface {
name = 'openai_4o'
Expand Down