提交 d0af08dd 编写于 作者: W weixin_44463441

Auto Commit

上级 cf7a4cfa
run = "npm i -f && npm run dev"
run = "npm i -f && sh ./build_preview.sh"
language = "node"
[deployment]
build = "npm i -f && npm run build"
run = "npm run preview"
run = "sh ./build_preview.sh"
[debugger]
program = "main.js"
#!/bin/bash
rm -rf dist/*
npm run build
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>AI知识库</title>
<script type="module" crossorigin src="/assets/index.de8f3e90.js"></script>
<link rel="stylesheet" href="/assets/index.213e6253.css">
<script type="module" crossorigin src="/assets/index.cadb18a6.js"></script>
<link rel="stylesheet" href="/assets/index.1eae589c.css">
</head>
<body class="bg-slate-300">
<div id="app"></div>
......
#!/bin/bash
rm -rf dist/*
npm run build
\ No newline at end of file
echo $INSCODE_API_KEY > ./dist/token.json
npm run preview
\ No newline at end of file
import { fetchEventSource } from '@microsoft/fetch-event-source';
import axios from 'axios';
import Prompt from './prompt.js'
const apiKey = process.env.INSCODE_API_KEY;
let apiKey = process.env.INSCODE_API_KEY;
const apiUrl = 'https://inscode-api.csdn.net/api/v1/gpt/';
class InsCodeAI {
......@@ -11,6 +12,24 @@ class InsCodeAI {
this.abortController = null
this.callback = null
this.temperature = parseFloat(config?.temperature??0.7)
this.loadToken()
}
loadToken () {
axios.get('/token.json', {
headers: {
'Accept': 'application/json'
}
}).then(res => {
debugger
const token = res?.data??''
if (token) {
apiKey = token
console.info('get token from env ' + apiKey)
}
})
}
createCompletion (prompt, history, context, callback) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册