49
49
{{ t('integration_openai', 'Leave the username and password empty to use the ones defined by your administrator') }}
50
50
</NcNoteCard >
51
51
<div class =" line" >
52
- <label for =" basic-user" >
53
- <KeyOutlineIcon :size =" 20" class =" icon" />
54
- {{ t('integration_openai', 'Username') }}
55
- </label >
56
- <input id =" openai-basic-user"
52
+ <NcTextField
53
+ id =" openai-basic-user"
57
54
v-model =" state.basic_user"
58
- type = " text "
55
+ class = " input "
59
56
:readonly =" readonly"
60
- :placeholder =" t('integration_openai', 'your Basic Auth user')"
61
- @input =" onSensitiveInput"
57
+ :label =" t('integration_openai', 'Basic Auth user')"
58
+ :show-trailing-button =" !!state.basic_user"
59
+ @update:model-value =" onSensitiveInput()"
60
+ @trailing-button-click =" state.basic_user = '' ; onSensitiveInput()"
62
61
@focus =" readonly = false" >
62
+ <template #icon >
63
+ <AccountOutlineIcon :size =" 20" />
64
+ </template >
65
+ </NcTextField >
63
66
</div >
64
67
<div class =" line" >
65
- <label for =" basic-password" >
66
- <KeyOutlineIcon :size =" 20" class =" icon" />
67
- {{ t('integration_openai', 'Password') }}
68
- </label >
69
- <input id =" openai-basic-password"
68
+ <NcTextField
69
+ id =" openai-basic-password"
70
70
v-model =" state.basic_password"
71
+ class =" input"
71
72
type =" password"
72
73
:readonly =" readonly"
73
- :placeholder =" t('integration_openai', 'your Basic Auth password')"
74
- @input =" onSensitiveInput"
74
+ :label =" t('integration_openai', 'Basic Auth password')"
75
+ :show-trailing-button =" !!state.basic_password"
76
+ @update:model-value =" onSensitiveInput()"
77
+ @trailing-button-click =" state.basic_password = '' ; onSensitiveInput()"
75
78
@focus =" readonly = false" >
79
+ <template #icon >
80
+ <KeyOutlineIcon :size =" 20" />
81
+ </template >
82
+ </NcTextField >
76
83
</div >
77
84
</div >
78
85
<div v-if =" quotaInfo !== null" >
113
120
</template >
114
121
115
122
<script >
123
+ import AccountOutlineIcon from ' vue-material-design-icons/AccountOutline.vue'
116
124
import InformationOutlineIcon from ' vue-material-design-icons/InformationOutline.vue'
117
125
import KeyOutlineIcon from ' vue-material-design-icons/KeyOutline.vue'
118
126
@@ -132,6 +140,7 @@ export default {
132
140
name: ' PersonalSettings' ,
133
141
134
142
components: {
143
+ AccountOutlineIcon,
135
144
OpenAiIcon,
136
145
KeyOutlineIcon,
137
146
InformationOutlineIcon,
@@ -167,17 +176,17 @@ export default {
167
176
this .saveOptions ({
168
177
})
169
178
}, 2000 ),
170
- onSensitiveInput: debounce (function () {
179
+ onSensitiveInput: debounce (async function () {
171
180
const values = {
172
- basic_user: this .state .basic_user ,
181
+ basic_user: ( this .state .basic_user ?? ' ' ). trim () ,
173
182
}
174
183
if (this .state .api_key !== ' dummyApiKey' ) {
175
- values .api_key = this .state .api_key
184
+ values .api_key = ( this .state .api_key ?? ' ' ). trim ()
176
185
}
177
186
if (this .state .basic_password !== ' dummyPassword' ) {
178
- values .basic_password = this .state .basic_password
187
+ values .basic_password = ( this .state .basic_password ?? ' ' ). trim ()
179
188
}
180
- this .saveOptions (values, true )
189
+ await this .saveOptions (values, true )
181
190
}, 2000 ),
182
191
async loadQuotaInfo () {
183
192
const url = generateUrl (' /apps/integration_openai/quota-info' )
0 commit comments