diff --git a/gpt-vue/pnpm-lock.yaml b/gpt-vue/pnpm-lock.yaml
index 9c4eaf8b..8efa9db5 100644
--- a/gpt-vue/pnpm-lock.yaml
+++ b/gpt-vue/pnpm-lock.yaml
@@ -60,6 +60,9 @@ importers:
'@vitejs/plugin-vue-jsx':
specifier: ^3.1.0
version: 3.1.0(vite@5.1.5)(vue@3.4.21)
+ '@vue/eslint-config-prettier':
+ specifier: ^7.0.0
+ version: 7.1.0(eslint@8.57.0)(prettier@3.2.5)
'@vue/eslint-config-typescript':
specifier: ^12.0.0
version: 12.0.0(eslint-plugin-vue@9.22.0)(eslint@8.57.0)(typescript@5.3.3)
@@ -1245,6 +1248,18 @@ packages:
resolution: {integrity: sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA==}
dev: false
+ /@vue/eslint-config-prettier@7.1.0(eslint@8.57.0)(prettier@3.2.5):
+ resolution: {integrity: sha512-Pv/lVr0bAzSIHLd9iz0KnvAr4GKyCEl+h52bc4e5yWuDVtLgFwycF7nrbWTAQAS+FU6q1geVd07lc6EWfJiWKQ==}
+ peerDependencies:
+ eslint: '>= 7.28.0'
+ prettier: '>= 2.0.0'
+ dependencies:
+ eslint: 8.57.0
+ eslint-config-prettier: 8.10.0(eslint@8.57.0)
+ eslint-plugin-prettier: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.57.0)(prettier@3.2.5)
+ prettier: 3.2.5
+ dev: true
+
/@vue/eslint-config-typescript@12.0.0(eslint-plugin-vue@9.22.0)(eslint@8.57.0)(typescript@5.3.3):
resolution: {integrity: sha512-StxLFet2Qe97T8+7L8pGlhYBBr8Eg05LPuTDVopQV6il+SK6qqom59BA/rcFipUef2jD8P2X44Vd8tMFytfvlg==}
engines: {node: ^14.17.0 || >=16.0.0}
@@ -1670,6 +1685,32 @@ packages:
engines: {node: '>=10'}
dev: true
+ /eslint-config-prettier@8.10.0(eslint@8.57.0):
+ resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==}
+ hasBin: true
+ peerDependencies:
+ eslint: '>=7.0.0'
+ dependencies:
+ eslint: 8.57.0
+ dev: true
+
+ /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0)(eslint@8.57.0)(prettier@3.2.5):
+ resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==}
+ engines: {node: '>=12.0.0'}
+ peerDependencies:
+ eslint: '>=7.28.0'
+ eslint-config-prettier: '*'
+ prettier: '>=2.0.0'
+ peerDependenciesMeta:
+ eslint-config-prettier:
+ optional: true
+ dependencies:
+ eslint: 8.57.0
+ eslint-config-prettier: 8.10.0(eslint@8.57.0)
+ prettier: 3.2.5
+ prettier-linter-helpers: 1.0.0
+ dev: true
+
/eslint-plugin-vue@9.22.0(eslint@8.57.0):
resolution: {integrity: sha512-7wCXv5zuVnBtZE/74z4yZ0CM8AjH6bk4MQGm7hZjUC2DBppKU5ioeOk5LGSg/s9a1ZJnIsdPLJpXnu1Rc+cVHg==}
engines: {node: ^14.17.0 || >=16.0.0}
@@ -1788,6 +1829,10 @@ packages:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
dev: true
+ /fast-diff@1.3.0:
+ resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==}
+ dev: true
+
/fast-glob@3.3.2:
resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==}
engines: {node: '>=8.6.0'}
@@ -2451,6 +2496,19 @@ packages:
engines: {node: '>= 0.8.0'}
dev: true
+ /prettier-linter-helpers@1.0.0:
+ resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
+ engines: {node: '>=6.0.0'}
+ dependencies:
+ fast-diff: 1.3.0
+ dev: true
+
+ /prettier@3.2.5:
+ resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==}
+ engines: {node: '>=14'}
+ hasBin: true
+ dev: true
+
/proxy-from-env@1.1.0:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
dev: false
diff --git a/gpt-vue/projects/vue-admin/.eslintrc.cjs b/gpt-vue/projects/vue-admin/.eslintrc.cjs
index ade85716..3ee7977d 100644
--- a/gpt-vue/projects/vue-admin/.eslintrc.cjs
+++ b/gpt-vue/projects/vue-admin/.eslintrc.cjs
@@ -1,14 +1,28 @@
/* eslint-env node */
-require('@rushstack/eslint-patch/modern-module-resolution')
+require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = {
root: true,
- 'extends': [
- 'plugin:vue/vue3-essential',
- 'eslint:recommended',
- '@vue/eslint-config-typescript'
+ extends: [
+ "plugin:vue/vue3-essential",
+ "eslint:recommended",
+ "@vue/eslint-config-typescript",
+ "@vue/eslint-config-prettier",
],
parserOptions: {
- ecmaVersion: 'latest'
- }
-}
+ ecmaVersion: "latest",
+ sourceType: "module",
+ parser: "@typescript-eslint/parser",
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ plugins: ["vue", "@typescript-eslint"],
+ rules: {
+ "prettier/prettier": "warn",
+ "@typescript-eslint/ban-ts-comment": "off",
+ "vue/multi-word-component-names": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "no-undef": "off",
+ },
+};
diff --git a/gpt-vue/projects/vue-admin/.prettierrc.json b/gpt-vue/projects/vue-admin/.prettierrc.json
new file mode 100644
index 00000000..80f5ac6c
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/.prettierrc.json
@@ -0,0 +1,9 @@
+{
+ "printWidth": 100,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": false,
+ "semi": true,
+ "trailingComma": "es5",
+ "bracketSpacing": true
+}
diff --git a/gpt-vue/projects/vue-admin/package.json b/gpt-vue/projects/vue-admin/package.json
index 113a8113..5c22a12c 100644
--- a/gpt-vue/projects/vue-admin/package.json
+++ b/gpt-vue/projects/vue-admin/package.json
@@ -24,6 +24,7 @@
"@types/node": "^20.11.10",
"@vitejs/plugin-vue": "^5.0.3",
"@vitejs/plugin-vue-jsx": "^3.1.0",
+ "@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.49.0",
diff --git a/gpt-vue/projects/vue-admin/src/components/ConfirmSwitch.vue b/gpt-vue/projects/vue-admin/src/components/ConfirmSwitch.vue
new file mode 100644
index 00000000..6f667023
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/components/ConfirmSwitch.vue
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/gpt-vue/projects/vue-admin/src/components/SimpleTable/SimpleTable.vue b/gpt-vue/projects/vue-admin/src/components/SimpleTable/SimpleTable.vue
index de0821b8..48251ab6 100644
--- a/gpt-vue/projects/vue-admin/src/components/SimpleTable/SimpleTable.vue
+++ b/gpt-vue/projects/vue-admin/src/components/SimpleTable/SimpleTable.vue
@@ -5,9 +5,10 @@ import { useTableScroll } from "@/components/SearchTable/utils";
import { Message } from "@arco-design/web-vue";
import type { TableRequest, TableOriginalProps } from "./useAsyncTable";
-export interface SimpleTable extends /* @vue-ignore */ TableOriginalProps {
+interface SimpleTable extends /* @vue-ignore */ TableOriginalProps {
request: TableRequest>;
params?: Record;
+ columns?: TableOriginalProps["columns"];
}
const props = defineProps();
diff --git a/gpt-vue/projects/vue-admin/src/composables/useSubmit.ts b/gpt-vue/projects/vue-admin/src/composables/useSubmit.ts
new file mode 100644
index 00000000..e0b31af2
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/composables/useSubmit.ts
@@ -0,0 +1,29 @@
+import { ref, reactive, unref } from "vue";
+import { Message } from "@arco-design/web-vue";
+import type { BaseResponse } from "@gpt-vue/packages/type";
+function useSubmit, R = any>(defaultData: T) {
+ const formRef = ref();
+ const formData = reactive({ ...defaultData });
+ const submitting = ref(false);
+
+ const handleSubmit = async (api: (params?: any) => Promise>, params) => {
+ submitting.value = true;
+ try {
+ const hasError = await formRef.value?.validate();
+ if (!hasError) {
+ const { data, message } = await api({ ...formData, ...unref(params) });
+ Message.success(message);
+ return Promise.resolve({ formData, data });
+ }
+ return Promise.reject(false);
+ } catch (err) {
+ return Promise.reject(err);
+ } finally {
+ submitting.value = false;
+ }
+ };
+
+ return { formRef, formData, handleSubmit, submitting };
+}
+
+export default useSubmit;
diff --git a/gpt-vue/projects/vue-admin/src/router/menu.ts b/gpt-vue/projects/vue-admin/src/router/menu.ts
index 429e6c19..ae243b69 100644
--- a/gpt-vue/projects/vue-admin/src/router/menu.ts
+++ b/gpt-vue/projects/vue-admin/src/router/menu.ts
@@ -42,6 +42,15 @@ const menu = [
},
component: () => import('@/views/Reward/RewardContainer.vue')
},
+ {
+ path: '/functions',
+ name: 'Functions',
+ meta: {
+ title: "函数管理",
+ icon: IconCalendar,
+ },
+ component: () => import('@/views/Functions/FunctionsContainer.vue')
+ },
{
path: '/loginLog',
name: 'LoginLog',
diff --git a/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsContainer.vue b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsContainer.vue
index e69de29b..ed8c3d5a 100644
--- a/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsContainer.vue
+++ b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsContainer.vue
@@ -0,0 +1,84 @@
+
+
+ 新增
+
+
+
+
+
+ 聊天{{ record.exchange.calls }}次
+ 绘图{{ record.exchange.img_calls }}次
+
+
+ 编辑
+
+ 删除
+
+
+
+
diff --git a/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsForm.vue b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsForm.vue
new file mode 100644
index 00000000..cabe3337
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsForm.vue
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 生成Token
+
+
+
+
+
+
+
+
+
+
diff --git a/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsFormTable.vue b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsFormTable.vue
new file mode 100644
index 00000000..8d61b139
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/views/Functions/FunctionsFormTable.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 新增参数
+
+
diff --git a/gpt-vue/projects/vue-admin/src/views/Functions/api.ts b/gpt-vue/projects/vue-admin/src/views/Functions/api.ts
new file mode 100644
index 00000000..77d9b8a1
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/views/Functions/api.ts
@@ -0,0 +1,41 @@
+import http from "@/http/config";
+
+export const getList = (params) => {
+ return http({
+ url: "/api/admin/function/list",
+ method: "get",
+ params
+ })
+}
+
+export const save = (data) => {
+ return http({
+ url: "/api/admin/function/save",
+ method: "post",
+ data
+ })
+}
+
+export const remove = (params) => {
+ return http({
+ url: "/api/admin/function/remove",
+ method: "get",
+ params
+ })
+}
+
+export const setStatus = (data) => {
+ return http({
+ url: "/api/admin/function/set",
+ method: "post",
+ data
+ })
+}
+
+export const token = (data) => {
+ return http({
+ url: "/api/admin/function/token",
+ method: "post",
+ data
+ })
+}
diff --git a/gpt-vue/projects/vue-admin/src/views/Functions/translateTableData.ts b/gpt-vue/projects/vue-admin/src/views/Functions/translateTableData.ts
new file mode 100644
index 00000000..1f87f306
--- /dev/null
+++ b/gpt-vue/projects/vue-admin/src/views/Functions/translateTableData.ts
@@ -0,0 +1,33 @@
+const get = (origin) => {
+ const { properties, required, type } = origin;
+ if (type === "object") {
+ const array = Object.keys(properties).reduce((prev, name) => {
+ return [
+ ...prev,
+ {
+ name,
+ ...properties[name],
+ required: required.includes(name),
+ },
+ ];
+ }, []);
+ return array;
+ }
+ return [];
+}
+
+const set = (tableData) => {
+ const properties = tableData.reduce((prev, curr) => {
+ return {
+ ...prev,
+ [curr.name]: {
+ description: curr.description,
+ type: curr.type,
+ },
+ };
+ }, {});
+ const required = tableData.filter((i) => i.required).map((i) => i.name);
+ return { properties, required, type: "object" }
+}
+
+export default { get, set }
\ No newline at end of file
diff --git a/gpt-vue/projects/vue-admin/src/views/Reward/RewardContainer.vue b/gpt-vue/projects/vue-admin/src/views/Reward/RewardContainer.vue
index 3b93763a..66f7caec 100644
--- a/gpt-vue/projects/vue-admin/src/views/Reward/RewardContainer.vue
+++ b/gpt-vue/projects/vue-admin/src/views/Reward/RewardContainer.vue
@@ -1,8 +1,8 @@
{{ dateFormat(record.updated_at) }}
- 未核销
+ 未核销
- 聊天{{ record.exchange.calls }}次
- 聊天{{ record.exchange.calls }}次
+ 绘图{{ record.exchange.img_calls }}次
+
+
+ 删除
+
+
diff --git a/gpt-vue/projects/vue-admin/src/views/Reward/api.ts b/gpt-vue/projects/vue-admin/src/views/Reward/api.ts
index ed68ff00..0c7f8e34 100644
--- a/gpt-vue/projects/vue-admin/src/views/Reward/api.ts
+++ b/gpt-vue/projects/vue-admin/src/views/Reward/api.ts
@@ -6,4 +6,12 @@ export const getList = (params?: Record) => {
method: "get",
params
})
-}
\ No newline at end of file
+}
+
+export const remove = (params?: Record) => {
+ return http({
+ url: "/api/admin/reward/remove",
+ method: "get",
+ params
+ })
+}
diff --git a/gpt-vue/projects/vue-admin/tsconfig.app.json b/gpt-vue/projects/vue-admin/tsconfig.app.json
index e14c754d..05ba2048 100644
--- a/gpt-vue/projects/vue-admin/tsconfig.app.json
+++ b/gpt-vue/projects/vue-admin/tsconfig.app.json
@@ -3,6 +3,8 @@
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
+ "strict": false,
+ "noImplicitAny": false,
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
diff --git a/gpt-vue/projects/vue-admin/tsconfig.node.json b/gpt-vue/projects/vue-admin/tsconfig.node.json
index 52de997d..d12d4b7f 100644
--- a/gpt-vue/projects/vue-admin/tsconfig.node.json
+++ b/gpt-vue/projects/vue-admin/tsconfig.node.json
@@ -8,6 +8,7 @@
"playwright.config.*"
],
"compilerOptions": {
+
"composite": true,
"noEmit": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",