调整内容显示

This commit is contained in:
aixianling
2023-05-12 18:12:21 +08:00
parent cd8e0f57aa
commit 0cdc165cbf
3 changed files with 12 additions and 3 deletions

View File

@@ -31,8 +31,8 @@
</template> </template>
<script> <script>
import {copyToClipboard} from "src/utils/tools";
import IconCopy from "../icons/iconCopy"; import IconCopy from "../icons/iconCopy";
import {copyToClipboard} from "../utils/tools";
export default { export default {
name: "chatContent", name: "chatContent",

View File

@@ -1,6 +1,6 @@
import VMdPreviewHtml from '@kangc/v-md-editor/lib/preview-html'; import VMdPreviewHtml from '@kangc/v-md-editor/lib/preview-html';
import '@kangc/v-md-editor/lib/style/preview-html.css'; import '@kangc/v-md-editor/lib/style/preview-html.css';
import '@kangc/v-md-editor/lib/theme/style/vuepress'; import '@kangc/v-md-editor/lib/theme/style/vuepress.css';
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import {createApp} from 'vue' import {createApp} from 'vue'

View File

@@ -10,6 +10,8 @@ class BaseModel {
} }
export class ChatGPT extends BaseModel { export class ChatGPT extends BaseModel {
static base = "https://chatwithai.pages.dev"
constructor() { constructor() {
super({ super({
avatar: AI_AVATAR, avatar: AI_AVATAR,
@@ -20,11 +22,13 @@ export class ChatGPT extends BaseModel {
} }
async chat(history, callback) { async chat(history, callback) {
return await axios.post("") return await axios.post(ChatGPT.base + "/v1/chat/completions")
} }
} }
export class ChatGLM extends BaseModel { export class ChatGLM extends BaseModel {
static base = "https://chatglm.cn/chatglm/backend-api"
constructor() { constructor() {
super({ super({
avatar: AI_AVATAR, avatar: AI_AVATAR,
@@ -33,4 +37,9 @@ export class ChatGLM extends BaseModel {
desc: "ChatGLM-6B所基于的模型" desc: "ChatGLM-6B所基于的模型"
}); });
} }
async chat(history, callback) {
const context = await axios.post(ChatGPT.base + "/v1/stream_context").then(res => res.json());
return await axios.get(ChatGPT.base + "/v1/stream", {params: context.result})
}
} }