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({ export default modalTemplate({
data: () => ({ data: () => ({
apiKey: this.config.apiKey, apiKey: null,
proxyHost: this.config.proxyHost, proxyHost: null,
}), }),
computedLocalSettings: {
apiKey: 'chatgptApiKey',
proxyHost: 'chatgptProxyHost',
},
methods: { methods: {
resolve() { resolve() {
if (!this.apiKey) { if (!this.apiKey) {
@ -48,5 +44,9 @@ export default modalTemplate({
this.config.resolve({ apiKey: this.apiKey, proxyHost: this.proxyHost }); this.config.resolve({ apiKey: this.apiKey, proxyHost: this.proxyHost });
}, },
}, },
mounted() {
this.apiKey = this.config.apiKey;
this.proxyHost = this.config.proxyHost;
},
}); });
</script> </script>

View File

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

View File

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