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

chore: update

上级 b5fb3af4
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
AButton: typeof import('@arco-design/web-vue')['Button']
ADrawer: typeof import('@arco-design/web-vue')['Drawer']
AInput: typeof import('@arco-design/web-vue')['Input']
APopover: typeof import('@arco-design/web-vue')['Popover']
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
IconCheck: typeof import('@arco-design/web-vue/es/icon')['IconCheck']
IconCopy: typeof import('@arco-design/web-vue/es/icon')['IconCopy']
}
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"name": "skyagents", "name": "skyagents",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@baiducloud/qianfan": "^0.0.8",
"@floating-ui/vue": "^1.0.6", "@floating-ui/vue": "^1.0.6",
"@microsoft/fetch-event-source": "^2.0.1", "@microsoft/fetch-event-source": "^2.0.1",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
...@@ -86,6 +87,30 @@ ...@@ -86,6 +87,30 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/@baiducloud/qianfan": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/@baiducloud/qianfan/-/qianfan-0.0.8.tgz",
"integrity": "sha512-xSkbLsnmLkM5Agk98FVFwcT3j1ajo5O+pT613WivjjL5ciE+VBFG7XJABAP7gWEk3Rp2vH6g32vygawfJp3a+Q==",
"dependencies": {
"async-mutex": "^0.5.0",
"bottleneck": "^2.19.5",
"debug": "^3.1.0",
"dotenv": "^16.4.1",
"rollup": "^4.9.6",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"underscore": "^1.9.1",
"urlencode": "^1.1.0"
}
},
"node_modules/@baiducloud/qianfan/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/@ctrl/tinycolor": { "node_modules/@ctrl/tinycolor": {
"version": "3.6.1", "version": "3.6.1",
"resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz",
...@@ -700,7 +725,6 @@ ...@@ -700,7 +725,6 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"android" "android"
...@@ -713,7 +737,6 @@ ...@@ -713,7 +737,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"android" "android"
...@@ -726,7 +749,6 @@ ...@@ -726,7 +749,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"darwin" "darwin"
...@@ -739,7 +761,6 @@ ...@@ -739,7 +761,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"darwin" "darwin"
...@@ -752,7 +773,6 @@ ...@@ -752,7 +773,6 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -765,7 +785,6 @@ ...@@ -765,7 +785,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -778,7 +797,6 @@ ...@@ -778,7 +797,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -791,7 +809,6 @@ ...@@ -791,7 +809,6 @@
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -804,7 +821,6 @@ ...@@ -804,7 +821,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -817,7 +833,6 @@ ...@@ -817,7 +833,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"linux" "linux"
...@@ -830,7 +845,6 @@ ...@@ -830,7 +845,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"win32" "win32"
...@@ -843,7 +857,6 @@ ...@@ -843,7 +857,6 @@
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"win32" "win32"
...@@ -856,7 +869,6 @@ ...@@ -856,7 +869,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"optional": true, "optional": true,
"os": [ "os": [
"win32" "win32"
...@@ -865,8 +877,7 @@ ...@@ -865,8 +877,7 @@
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
"dev": true
}, },
"node_modules/@types/lodash": { "node_modules/@types/lodash": {
"version": "4.14.202", "version": "4.14.202",
...@@ -1221,6 +1232,14 @@ ...@@ -1221,6 +1232,14 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true "dev": true
}, },
"node_modules/async-mutex": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz",
"integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==",
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/async-validator": { "node_modules/async-validator": {
"version": "4.2.5", "version": "4.2.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz", "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz",
...@@ -1279,6 +1298,11 @@ ...@@ -1279,6 +1298,11 @@
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
"dev": true "dev": true
}, },
"node_modules/bottleneck": {
"version": "2.19.5",
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
},
"node_modules/bowser": { "node_modules/bowser": {
"version": "1.9.4", "version": "1.9.4",
"resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz", "resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz",
...@@ -1622,6 +1646,17 @@ ...@@ -1622,6 +1646,17 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/ee-first": { "node_modules/ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
...@@ -2210,7 +2245,6 @@ ...@@ -2210,7 +2245,6 @@
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"optional": true, "optional": true,
"os": [ "os": [
...@@ -2389,7 +2423,6 @@ ...@@ -2389,7 +2423,6 @@
"version": "0.4.24", "version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"dependencies": { "dependencies": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": ">= 2.1.2 < 3"
}, },
...@@ -2831,8 +2864,7 @@ ...@@ -2831,8 +2864,7 @@
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
"dev": true
}, },
"node_modules/mz": { "node_modules/mz": {
"version": "2.7.0", "version": "2.7.0",
...@@ -3301,7 +3333,6 @@ ...@@ -3301,7 +3333,6 @@
"version": "4.12.1", "version": "4.12.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.12.1.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.12.1.tgz",
"integrity": "sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg==", "integrity": "sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg==",
"dev": true,
"dependencies": { "dependencies": {
"@types/estree": "1.0.5" "@types/estree": "1.0.5"
}, },
...@@ -3361,8 +3392,7 @@ ...@@ -3361,8 +3392,7 @@
"node_modules/safer-buffer": { "node_modules/safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
"dev": true
}, },
"node_modules/sax": { "node_modules/sax": {
"version": "1.3.0", "version": "1.3.0",
...@@ -3633,6 +3663,11 @@ ...@@ -3633,6 +3663,11 @@
"node": ">=8.0" "node": ">=8.0"
} }
}, },
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/type-check": { "node_modules/type-check": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
...@@ -3657,12 +3692,29 @@ ...@@ -3657,12 +3692,29 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/typescript": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/ufo": { "node_modules/ufo": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.4.0.tgz",
"integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==", "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==",
"dev": true "dev": true
}, },
"node_modules/underscore": {
"version": "1.13.6",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
},
"node_modules/unescape": { "node_modules/unescape": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/unescape/-/unescape-1.0.1.tgz", "resolved": "https://registry.npmjs.org/unescape/-/unescape-1.0.1.tgz",
...@@ -3869,6 +3921,14 @@ ...@@ -3869,6 +3921,14 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/urlencode": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/urlencode/-/urlencode-1.1.0.tgz",
"integrity": "sha512-OOAOh9owHXr/rCN1tteSnYwIvsrGHamSz0hafMhmQa7RcS4+Ets6/2iVClVGjt9jkDW84UqoMw/Gmpc7QolX6A==",
"dependencies": {
"iconv-lite": "~0.4.11"
}
},
"node_modules/urllib": { "node_modules/urllib": {
"version": "2.41.0", "version": "2.41.0",
"resolved": "https://registry.npmjs.org/urllib/-/urllib-2.41.0.tgz", "resolved": "https://registry.npmjs.org/urllib/-/urllib-2.41.0.tgz",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"release": "npm run build && npm run deploy" "release": "npm run build && npm run deploy"
}, },
"dependencies": { "dependencies": {
"@baiducloud/qianfan": "^0.0.8",
"@floating-ui/vue": "^1.0.6", "@floating-ui/vue": "^1.0.6",
"@microsoft/fetch-event-source": "^2.0.1", "@microsoft/fetch-event-source": "^2.0.1",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
......
<script setup> <script setup>
import { useTextSelection, watchDebounced, useClipboard } from '@vueuse/core' import { useTextSelection, watchDebounced, useClipboard } from '@vueuse/core'
import { useFloating } from '@floating-ui/vue' import { useFloating } from '@floating-ui/vue'
import { useChat } from '@/composables/useChat' import { useChat } from '@/composables/useQianFan'
const blacklist = ['saas-x.ezijing.com'] const blacklist = ['saas-x.ezijing.com']
......
import { ChatCompletion } from '@baiducloud/qianfan'
// 手动传 AK/SK
const client = new ChatCompletion({ QIANFAN_AK: 'wY7bvMpkWeZbDVq9w3EDvpjU', QIANFAN_SK: 'XJwpiJWxs5HXkOtbo6tQrvYPZFJAWdAy' })
async function main() {
const resp = await client.chat(
{
messages: [
{
role: 'user',
content: '今天深圳天气'
}
]
},
'ERNIE-4.0-8K'
)
console.log(resp)
}
main()
import { ChatCompletion } from '@baiducloud/qianfan'
// 手动传 AK/SK
const client = new ChatCompletion({ QIANFAN_AK: 'wY7bvMpkWeZbDVq9w3EDvpjU', QIANFAN_SK: 'XJwpiJWxs5HXkOtbo6tQrvYPZFJAWdAy' })
async function main() {
const resp = await client.chat(
{
messages: [
{
role: 'user',
content: '今天深圳天气'
}
]
},
'ERNIE-4.0-8K'
)
console.log(resp)
}
main()
import axios from 'axios'
export function useChat() {
const AK = 'wY7bvMpkWeZbDVq9w3EDvpjU'
const SK = 'XJwpiJWxs5HXkOtbo6tQrvYPZFJAWdAy'
const messages = ref([])
const chatId = ref(null)
const isLoading = ref(false)
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()), {
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
}
async function getAccessToken() {
const res = await axios.post('/api/ai/oauth/2.0/token?grant_type=client_credentials&client_id=' + AK + '&client_secret=' + SK)
return res.data.access_token
}
return { chatId, messages, post, isLoading }
}
...@@ -34,7 +34,12 @@ export default defineConfig({ ...@@ -34,7 +34,12 @@ export default defineConfig({
server: { server: {
open: true, open: true,
proxy: { proxy: {
'/api/ai': 'https://saas-lab.ezijing.com' // '/api/ai': 'https://saas-lab.ezijing.com'
'/api/ai': {
target: 'https://aip.baidubce.com',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/ai/, '')
}
} }
}, },
build: { build: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论