@@ -17,6 +17,9 @@ interface SettingState {
1717 apiKey : string
1818 setApiKey : ( apiKey : string ) => void
1919
20+ model : string
21+ setModel : ( language : string ) => void
22+
2023 markDescGen : boolean
2124 setMarkDescGen : ( markDescGen : boolean ) => void
2225
@@ -29,14 +32,14 @@ interface SettingState {
2932 codeTheme : string
3033 setCodeTheme : ( codeTheme : string ) => void
3134
32- tesseractList : string [ ]
33- setTesseractList : ( tesseractList : string [ ] ) => void
35+ tesseractList : string
36+ setTesseractList : ( tesseractList : string ) => void
3437
3538 screenshotShortcut : string
3639 setScreenshotShortcut : ( screenshotShortcut : string ) => void
3740
3841 githubUsername : string
39- setGithubUsername : ( githubUsername : string ) => void
42+ setGithubUsername : ( githubUsername : string ) => Promise < void >
4043
4144 accessToken : string
4245 setAccessToken : ( accessToken : string ) => void
@@ -73,6 +76,9 @@ const useSettingStore = create<SettingState>((set, get) => ({
7376 apiKey : '' ,
7477 setApiKey : ( apiKey : string ) => set ( { apiKey } ) ,
7578
79+ model : 'gpt-4o-mini' ,
80+ setModel : ( model : string ) => set ( { model } ) ,
81+
7682 markDescGen : true ,
7783 setMarkDescGen : ( markDescGen : boolean ) => set ( { markDescGen } ) ,
7884
@@ -85,14 +91,18 @@ const useSettingStore = create<SettingState>((set, get) => ({
8591 codeTheme : 'atom' ,
8692 setCodeTheme : ( codeTheme : string ) => set ( { codeTheme } ) ,
8793
88- tesseractList : [ ] ,
89- setTesseractList : ( tesseractList : string [ ] ) => set ( { tesseractList } ) ,
94+ tesseractList : 'eng,chi_sim' ,
95+ setTesseractList : ( tesseractList : string ) => set ( { tesseractList } ) ,
9096
9197 screenshotShortcut : 'Command+Shift+R' ,
9298 setScreenshotShortcut : ( screenshotShortcut : string ) => set ( { screenshotShortcut } ) ,
9399
94100 githubUsername : '' ,
95- setGithubUsername : ( githubUsername : string ) => set ( { githubUsername } ) ,
101+ setGithubUsername : async ( githubUsername : string ) => {
102+ set ( { githubUsername } )
103+ const store = await Store . load ( 'store.json' ) ;
104+ store . set ( 'githubUsername' , githubUsername )
105+ } ,
96106
97107 accessToken : '' ,
98108 setAccessToken : ( accessToken : string ) => set ( { accessToken } ) ,
0 commit comments