ChatGPT辅助写作窗口控制台报错bugfix

This commit is contained in:
xiaoqi.cxq 2023-04-11 09:30:15 +08:00
parent 64d493d692
commit 20d7a9d2db
3 changed files with 11 additions and 11 deletions

View File

@ -30,13 +30,9 @@ import modalTemplate from './common/modalTemplate';
export default modalTemplate({
data: () => ({
apiKey: this.config.apiKey,
proxyHost: this.config.proxyHost,
apiKey: null,
proxyHost: null,
}),
computedLocalSettings: {
apiKey: 'chatgptApiKey',
proxyHost: 'chatgptProxyHost',
},
methods: {
resolve() {
if (!this.apiKey) {
@ -48,5 +44,9 @@ export default modalTemplate({
this.config.resolve({ apiKey: this.apiKey, proxyHost: this.proxyHost });
},
},
mounted() {
this.apiKey = this.config.apiKey;
this.proxyHost = this.config.proxyHost;
},
});
</script>

View File

@ -6,7 +6,7 @@
</div>
<p><b>ChatGPT内容生成</b><br>生成时长受ChatGPT服务响应与网络响应时长影响时间可能较长</p>
<form-entry label="生成内容要求详细描述" error="content">
<textarea slot="field" class="text-input" type="text" placeholder="输入内容" v-model.trim="content" :disabled="generating || !chatGptConfig.apiKey"></textarea>
<textarea slot="field" class="text-input" type="text" placeholder="输入内容(支持换行)" v-model.trim="content" :disabled="generating || !chatGptConfig.apiKey"></textarea>
<div class="form-entry__info">
<span v-if="!chatGptConfig.apiKey" class="config-warning">
未配置apiKey请点击 <a href="javascript:void(0)" @click="openConfig">配置</a> apiKey
@ -20,8 +20,8 @@
</div>
</form-entry>
<div class="modal__result">
<span v-if="generating && !result">(等待生成中...)</span>
<pre class="result_pre" v-text="result"></pre>
<pre class="result_pre" v-if="generating && !result">(等待生成中...)</pre>
<pre class="result_pre" v-else v-text="result"></pre>
</div>
</div>
<div class="modal__button-bar">
@ -139,7 +139,7 @@ export default modalTemplate({
}
.text-input {
min-height: 50px;
min-height: 60px;
}
}
</style>

View File

@ -17,7 +17,7 @@ export default {
uid: utils.uid(),
}),
mounted() {
this.$el.querySelector('input,select').id = this.uid;
this.$el.querySelector('input,select,textarea').id = this.uid;
},
};
</script>