布局先提交一波

This commit is contained in:
aixianling
2023-05-12 15:53:39 +08:00
parent 81f76164d8
commit 8d362c7468
18 changed files with 2800 additions and 188 deletions

6
src/utils/axios.js Normal file
View File

@@ -0,0 +1,6 @@
import axios from "axios";
const ins = axios.create({
})
export default ins

7
src/utils/env.js Normal file
View File

@@ -0,0 +1,7 @@
export const OPEN_AI_KEY = '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'
//ai头像
export const AI_AVATAR = "https://th.bing.com/th?id=ODL.3e2fbff4543f0d3632d34be6d02adc93&w=100&h=100&c=12&pcl=faf9f7&o=6&dpr=1.5&pid=13.1"
//用户头像
export const USER_AVATAR = "https://avatars.githubusercontent.com/u/20533272?v=4"

31
src/utils/models.js Normal file
View File

@@ -0,0 +1,31 @@
import {AI_AVATAR} from "./env";
class BaseModel {
constructor(props) {
for (const k in props) {
this[k] = props[k];
}
}
}
export class ChatGPT extends BaseModel {
constructor() {
super({
avatar: AI_AVATAR,
name: 'ChatGPT',
id: "gpt-3.5-turbo",
desc: "ChatGPT-3.5所基于的模型"
});
}
}
export class ChatGLM extends BaseModel {
constructor() {
super({
avatar: AI_AVATAR,
name: 'ChatGLM',
id: "chatglm-6b",
desc: "ChatGLM-6B所基于的模型"
});
}
}

25
src/utils/tools.js Normal file
View File

@@ -0,0 +1,25 @@
/**
* 复制到剪切板
*/
export function copyToClipboard(content) {
const clipboardData = window.clipboardData
if (clipboardData) {
clipboardData.clearData()
clipboardData.setData('Text', content)
return true
} else if (document.execCommand) {
const el = document.createElement('textarea')
el.value = content
el.setAttribute('readonly', '')
el.style.position = 'absolute'
el.style.left = '-9999px'
document.body.appendChild(el)
el.select()
document.execCommand('copy')
document.body.removeChild(el)
return true
}
return false
}