Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Mar 17, 2023
1 parent 125ce19 commit db5db56
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/Application/Api/Controller/AiController.class.php
Expand Up @@ -48,7 +48,7 @@ public function send($content)
$curl = curl_init(); //初始化
curl_setopt($curl, CURLOPT_URL, $api_base_url . '/v1/chat/completions'); //设置url
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式
curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据
Expand Down
Expand Up @@ -150,6 +150,8 @@ import Editormd from '@/components/common/Editormd'
import Toc from '@/components/common/Toc'
import Header from '../Header'
import HeaderRight from './HeaderRight'
import { rederPageContent } from '@/models/page'
export default {
props: {
item_info: ''
Expand Down Expand Up @@ -181,7 +183,7 @@ export default {
page_id: page_id
}).then(data => {
const json = data.data
this.content = json.page_content
this.content = rederPageContent(json.page_content)
this.page_title = json.page_title
})
},
Expand Down
16 changes: 12 additions & 4 deletions web_src/src/components/page/edit/AI.vue
Expand Up @@ -37,6 +37,7 @@
<el-col :span="12">
<h3>输出区</h3>
<el-input
v-loading="loading"
type="textarea"
class="dialoContent"
placeholder=" "
Expand All @@ -63,17 +64,24 @@ export default {
data() {
return {
content: '',
outputContent: ''
outputContent: '',
loading: false
}
},
methods: {
createContent() {
this.outputContent = '生成中...'
this.outputContent = ''
this.loading = true
this.request('/api/ai/create', {
content: this.content
}).then(data => {
this.outputContent = data.data.choices[0].message.content
})
.then(data => {
this.outputContent = data.data.choices[0].message.content
this.loading = false
})
.catch(() => {
this.loading = false
})
}
},
mounted() {}
Expand Down
2 changes: 1 addition & 1 deletion web_src/src/http.js
Expand Up @@ -6,7 +6,7 @@ import axios from 'axios'
import router from '@/router/index'

// axios 配置
axios.defaults.timeout = 20000
axios.defaults.timeout = 60000
axios.defaults.baseURL = DocConfig.server

// http request 拦截器
Expand Down

0 comments on commit db5db56

Please sign in to comment.