提交 9d01be9d authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 4cdbda0d
差异被折叠。
......@@ -16,21 +16,22 @@
"@floating-ui/vue": "^1.0.6",
"@microsoft/fetch-event-source": "^2.0.1",
"@vueuse/core": "^10.9.0",
"axios": "^1.6.7",
"axios": "^1.6.8",
"blueimp-md5": "^2.19.0",
"element-plus": "^2.6.1",
"element-plus": "^2.6.2",
"vue": "^3.4.21"
},
"devDependencies": {
"@arco-design/web-vue": "^2.54.6",
"@arco-design/web-vue": "^2.55.0",
"@vitejs/plugin-vue": "^5.0.4",
"ali-oss": "^6.20.0",
"chalk": "^5.3.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"eslint-plugin-vue": "^9.24.0",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.6",
"vite-plugin-css-injected-by-js": "^3.4.0"
"vite": "^5.2.6",
"vite-plugin-css-injected-by-js": "^3.5.0",
"vite-plugin-node-polyfills": "^0.21.0"
}
}
......@@ -10,7 +10,7 @@ export function useChat() {
async function post(data) {
isLoading.value = true
const res = await axios.post('/api/ai/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=' + (await getAccessToken()), {
const res = await axios.post('/api/qianfan/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=' + (await getAccessToken()), {
messages: [{ role: 'user', content: data.userChatInput }],
disable_search: false,
enable_citation: false
......@@ -20,7 +20,7 @@ export function useChat() {
}
async function getAccessToken() {
const res = await axios.post('/api/ai/oauth/2.0/token?grant_type=client_credentials&client_id=' + AK + '&client_secret=' + SK)
const res = await axios.post('/api/qianfan/oauth/2.0/token?grant_type=client_credentials&client_id=' + AK + '&client_secret=' + SK)
return res.data.access_token
}
......
import { ChatCompletion } from '@baiducloud/qianfan'
export function useChat() {
const AK = 'wY7bvMpkWeZbDVq9w3EDvpjU'
const SK = 'XJwpiJWxs5HXkOtbo6tQrvYPZFJAWdAy'
const client = new ChatCompletion({ QIANFAN_AK: AK, QIANFAN_SK: SK })
const messages = ref([])
const chatId = ref(null)
const isLoading = ref(false)
async function post(data) {
isLoading.value = true
const res = await client.chat({
messages: [{ role: 'user', content: data.userChatInput }],
disable_search: false,
enable_citation: false
})
messages.value.push({ role: 'assistant', content: res.data.result.replaceAll('\n', '<br/>') })
isLoading.value = false
}
return { chatId, messages, post, isLoading }
}
......@@ -34,12 +34,12 @@ export default defineConfig({
server: {
open: true,
proxy: {
// '/api/ai': 'https://saas-lab.ezijing.com'
'/api/ai': {
target: 'https://aip.baidubce.com',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/ai/, '')
}
'/api': 'https://saas-lab.ezijing.com'
// '/api/ai': {
// target: 'https://aip.baidubce.com',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api\/ai/, '')
// }
}
},
build: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论