Skip to content

Commit

Permalink
chore: change default tickmark to default profile if none present
Browse files Browse the repository at this point in the history
  • Loading branch information
rootCircle committed Dec 7, 2024
1 parent 6f5b5f5 commit 2a01cec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/utils/defaultProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface typeDefaultProperties {
enableConsensus: boolean;
llmWeights: Record<LLMEngineType, number>;
automaticFillingEnabled: boolean;
defaultProfileKey: string;
defaultProfile: Profile;
}
const LLMWeightsMap = {
Expand All @@ -23,6 +24,7 @@ const DEFAULT_PROPERTIES: typeDefaultProperties = {
enableConsensus: false,
llmWeights: LLMWeightsMap,
automaticFillingEnabled: true,
defaultProfileKey: 'default',
defaultProfile: {
name: 'All Rounder',
image_url:
Expand Down
9 changes: 6 additions & 3 deletions src/utils/storage/profiles/profileManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { v4 } from 'uuid';
import { EMPTY_STRING } from '@utils/settings';
import { DEFAULT_PROPERTIES } from '@utils/defaultProperties';

import { profilesData } from './profilesData';
Expand All @@ -11,7 +10,8 @@ async function loadProfiles(): Promise<Profiles> {
(result['customProfiles'] as Profiles) || {};

const mergedProfiles = {
default: DEFAULT_PROPERTIES.defaultProfile,
[DEFAULT_PROPERTIES.defaultProfileKey]:
DEFAULT_PROPERTIES.defaultProfile,
...profilesData,
...customProfiles,
};
Expand Down Expand Up @@ -110,7 +110,10 @@ async function saveSelectedProfileKey(profileKey: string): Promise<void> {
async function getSelectedProfileKey() {
return await new Promise<string>((resolve) => {
chrome.storage.sync.get(['selectedProfileKey'], (result) => {
resolve((result['selectedProfileKey'] as string) || EMPTY_STRING);
resolve(
(result['selectedProfileKey'] as string) ||
DEFAULT_PROPERTIES.defaultProfileKey,
);
});
});
}
Expand Down

0 comments on commit 2a01cec

Please sign in to comment.