chatgpt优化

This commit is contained in:
xiaoqi.cxq 2023-07-01 19:40:16 +08:00
parent 9cd27e274e
commit e04fd5a911
2 changed files with 10 additions and 6 deletions

View File

@ -8,7 +8,7 @@
<form-entry label="生成内容要求详细描述" error="content">
<textarea slot="field" class="text-input" type="text" placeholder="输入内容(支持换行)" v-model.trim="content" :disabled="generating"></textarea>
<div class="form-entry__info">
使用 <a href="https://chat1.52ai.pw/" target="_blank">chat1.52ai.pw</a> 的免费接口生成内容AI模型是GPT-3.5 Turbo
使用 <a href="https://api35.pxj123.cn/" target="_blank">api35.pxj123.cn</a> 的免费接口生成内容AI模型是GPT-3.5 Turbo
</div>
</form-entry>
<div class="modal__result">
@ -80,10 +80,14 @@ export default modalTemplate({
callback(null);
},
},
async created() {
// store chatgpt
const config = localStorage.getItem('chatgpt/config');
store.dispatch('chatgpt/setCurrConfig', JSON.parse(config || '{}'));
mounted() {
const script = document.createElement('script');
script.src = `https://api35.pxj123.cn/js/chat.js?t=${new Date().getTime()}`;
script.onload = () => {
/* eslint-disable */
console.log('加载外部chatgpt的js成功!');
};
this.$el.appendChild(script);
},
});
</script>

View File

@ -6,7 +6,7 @@ export default {
const url = 'https://fd.52ai.pw/v1/chat/completions';
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer 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');
xhr.setRequestHeader('Authorization', `Bearer ${window.my_api_key}`);
xhr.send(JSON.stringify({
model: 'gpt-3.5-turbo',
max_tokens: 3000,