@@ -4,6 +4,7 @@ document.addEventListener("DOMContentLoaded", function () {
4
4
var actionsContainer = document . getElementById ( "actions-container" ) ;
5
5
var addActionButton = document . getElementById ( "add-action" ) ;
6
6
var saveButton = document . getElementById ( "save-settings" ) ;
7
+ var maxTokensInput = document . getElementById ( "max-tokens" ) ;
7
8
var defaultButton = document . getElementById ( "default-settings" ) ;
8
9
var defaultActions = [
9
10
{ name : "Reply to this" , prompt : "Reply to the following email." } ,
@@ -14,9 +15,10 @@ document.addEventListener("DOMContentLoaded", function () {
14
15
{ name : "Prompt provided" , prompt : " " } ,
15
16
] ;
16
17
var defaultModel = "gpt-3.5-turbo" ;
17
- browser . storage . local . get ( [ "model" , "apiKey" , "actions" ] , function ( data ) {
18
+ browser . storage . local . get ( [ "model" , "apiKey" , "actions" , "maxTokens" ] , function ( data ) {
18
19
modelSelect . value = data . model || defaultModel ;
19
20
apiKeyInput . value = data . apiKey || "" ;
21
+ maxTokensInput . value = data . maxTokens || 0 ;
20
22
var actions = data . actions || defaultActions ;
21
23
actions . forEach ( function ( action ) {
22
24
addAction ( action . name , action . prompt ) ;
@@ -31,14 +33,15 @@ document.addEventListener("DOMContentLoaded", function () {
31
33
var promptInput = actionDiv . querySelector ( ".action-prompt" ) ;
32
34
return { name : nameInput . value , prompt : promptInput . value } ;
33
35
} ) ;
34
- browser . storage . local . set ( { model : modelSelect . value , apiKey : apiKeyInput . value , actions : actions } ) ;
36
+ browser . storage . local . set ( { model : modelSelect . value , apiKey : apiKeyInput . value , actions : actions , maxTokens : maxTokensInput . value } ) ;
35
37
} ) ;
36
38
defaultButton . addEventListener ( "click" , function ( ) {
37
39
while ( actionsContainer . firstChild ) {
38
40
actionsContainer . removeChild ( actionsContainer . firstChild ) ;
39
41
}
40
42
modelSelect . value = defaultModel ;
41
43
apiKeyInput . value = "" ;
44
+ maxTokens . value = 0 ;
42
45
defaultActions . forEach ( function ( action ) {
43
46
addAction ( action . name , action . prompt ) ;
44
47
} ) ;
0 commit comments