File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1
1
import BingAIClient from '../clients/BingAIClient'
2
+ import { getUserConfig } from '../../config/index.mjs'
2
3
3
4
/**
4
5
* @param {Runtime.Port } port
@@ -49,6 +50,7 @@ export async function generateAnswersWithBingWebApi(
49
50
answer = answer . replaceAll ( / \[ \^ \d + \^ \] / g, '' )
50
51
port . postMessage ( { answer : answer , done : false , session : null } )
51
52
} ,
53
+ toneStyle : ( await getUserConfig ( ) ) . modelMode ,
52
54
} )
53
55
. catch ( ( err ) => {
54
56
port . onMessage . removeListener ( stopListener )
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ export const ThemeMode = {
39
39
auto : 'Auto' ,
40
40
}
41
41
42
+ export const ModelMode = {
43
+ balanced : 'Balanced' ,
44
+ creative : 'Creative' ,
45
+ precise : 'Precise' ,
46
+ fast : 'Fast' ,
47
+ }
48
+
42
49
export const maxResponseTokenLength = 1000
43
50
44
51
/**
@@ -54,6 +61,8 @@ export const defaultConfig = {
54
61
/** @type {keyof Models }*/
55
62
modelName : 'chatgptFree35' ,
56
63
apiKey : '' ,
64
+ /** @type {keyof ModelMode }*/
65
+ modelMode : 'balanced' ,
57
66
preferredLanguage : navigator . language . substring ( 0 , 2 ) ,
58
67
insertAtTop : isMobile ( ) ,
59
68
lockWhenAnswer : false ,
@@ -128,6 +137,10 @@ export function isUsingApiKey(config) {
128
137
)
129
138
}
130
139
140
+ export function isUsingMultiModeModel ( config ) {
141
+ return bingWebModelKeys . includes ( config . modelName )
142
+ }
143
+
131
144
export function isUsingCustomModel ( config ) {
132
145
return customApiModelKeys . includes ( config . modelName )
133
146
}
Original file line number Diff line number Diff line change 5
5
getUserConfig ,
6
6
isUsingApiKey ,
7
7
isUsingCustomModel ,
8
+ isUsingMultiModeModel ,
9
+ ModelMode ,
8
10
Models ,
9
11
setUserConfig ,
10
12
ThemeMode ,
@@ -78,7 +80,9 @@ function GeneralPart({ config, updateConfig }) {
78
80
< legend > API Mode</ legend >
79
81
< span style = "display: flex; gap: 15px;" >
80
82
< select
81
- style = { isUsingApiKey ( config ) ? 'width: 50%;' : undefined }
83
+ style = {
84
+ isUsingApiKey ( config ) || isUsingMultiModeModel ( config ) ? 'width: 50%;' : undefined
85
+ }
82
86
required
83
87
onChange = { ( e ) => {
84
88
const modelName = e . target . value
@@ -93,6 +97,25 @@ function GeneralPart({ config, updateConfig }) {
93
97
)
94
98
} ) }
95
99
</ select >
100
+ { isUsingMultiModeModel ( config ) && (
101
+ < span style = "width: 50%; display: flex; gap: 5px;" >
102
+ < select
103
+ required
104
+ onChange = { ( e ) => {
105
+ const modelMode = e . target . value
106
+ updateConfig ( { modelMode : modelMode } )
107
+ } }
108
+ >
109
+ { Object . entries ( ModelMode ) . map ( ( [ key , desc ] ) => {
110
+ return (
111
+ < option value = { key } key = { key } selected = { key === config . modelMode } >
112
+ { desc }
113
+ </ option >
114
+ )
115
+ } ) }
116
+ </ select >
117
+ </ span >
118
+ ) }
96
119
{ isUsingApiKey ( config ) && (
97
120
< span style = "width: 50%; display: flex; gap: 5px;" >
98
121
< input
You can’t perform that action at this time.
0 commit comments