@ -0,0 +1,21 @@
|
||||
/* eslint-env node */ |
||||
require('@rushstack/eslint-patch/modern-module-resolution') |
||||
|
||||
module.exports = { |
||||
root: true, |
||||
'extends': [ |
||||
'plugin:vue/vue3-essential', |
||||
'eslint:recommended', |
||||
'@vue/eslint-config-typescript', |
||||
'@vue/eslint-config-prettier/skip-formatting' |
||||
], |
||||
parserOptions: { |
||||
ecmaVersion: 'latest' |
||||
}, |
||||
rules: { |
||||
// 添加组件命名忽略规则 |
||||
"vue/multi-word-component-names": ["error",{ |
||||
"ignores": ["index","main"]//需要忽略的组件名 |
||||
}] |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
pnpm-debug.log* |
||||
lerna-debug.log* |
||||
|
||||
node_modules |
||||
.DS_Store |
||||
dist |
||||
dist-ssr |
||||
coverage |
||||
*.local |
||||
|
||||
/cypress/videos/ |
||||
/cypress/screenshots/ |
||||
|
||||
# Editor directories and files |
||||
.vscode/* |
||||
!.vscode/extensions.json |
||||
.idea |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.sw? |
@ -0,0 +1,8 @@
|
||||
{ |
||||
"$schema": "https://json.schemastore.org/prettierrc", |
||||
"semi": false, |
||||
"tabWidth": 2, |
||||
"singleQuote": true, |
||||
"printWidth": 100, |
||||
"trailingComma": "none" |
||||
} |
@ -0,0 +1,52 @@
|
||||
# web |
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. |
||||
|
||||
## Recommended IDE Setup |
||||
|
||||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). |
||||
|
||||
## Type Support for `.vue` Imports in TS |
||||
|
||||
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. |
||||
|
||||
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: |
||||
|
||||
1. Disable the built-in TypeScript Extension |
||||
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette |
||||
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` |
||||
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. |
||||
|
||||
## Customize configuration |
||||
|
||||
See [Vite Configuration Reference](https://vitejs.dev/config/). |
||||
|
||||
## Project Setup |
||||
|
||||
```sh |
||||
npm install |
||||
``` |
||||
|
||||
### Compile and Hot-Reload for Development |
||||
|
||||
```sh |
||||
npm run dev |
||||
``` |
||||
|
||||
### Type-Check, Compile and Minify for Production |
||||
|
||||
```sh |
||||
npm run build |
||||
``` |
||||
|
||||
### Run Unit Tests with [Vitest](https://vitest.dev/) |
||||
|
||||
```sh |
||||
npm run test:unit |
||||
``` |
||||
|
||||
### Lint with [ESLint](https://eslint.org/) |
||||
|
||||
```sh |
||||
npm run lint |
||||
``` |
@ -0,0 +1,17 @@
|
||||
/// <reference types="vite/client" />
|
||||
declare module 'element-plus/dist/locale/zh-cn.mjs' |
||||
declare module 'markdown-it-task-lists' |
||||
declare module 'markdown-it-abbr' |
||||
declare module 'markdown-it-anchor' |
||||
declare module 'markdown-it-footnote' |
||||
declare module 'markdown-it-sub' |
||||
declare module 'markdown-it-sup' |
||||
declare module 'markdown-it-toc-done-right' |
||||
declare module 'katex' |
||||
interface Window { |
||||
sendMessage: ?((message: string, other_params_data: any) => void) |
||||
} |
||||
interface ImportMeta { |
||||
readonly env: ImportMetaEnv |
||||
} |
||||
declare type Recordable<T = any> = Record<string, T> |
@ -0,0 +1,4 @@
|
||||
VITE_APP_NAME=ui |
||||
VITE_BASE_PATH=/ |
||||
VITE_APP_PORT=50000 |
||||
VITE_APP_TITLE = '智慧生态' |
@ -0,0 +1,42 @@
|
||||
<!doctype html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8" /> |
||||
<link rel="icon" href="/favicon.ico" /> |
||||
<meta |
||||
name="viewport" |
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, |
||||
viewport-fit=cover" |
||||
/> |
||||
<base target="_blank" /> |
||||
<title>%VITE_APP_TITLE%</title> |
||||
<script type="text/javascript" src="/js/jweixin-1.4.0.js"></script> |
||||
<script type="text/javascript" src="/js/uni.webview.1.5.2.js"></script> |
||||
</head> |
||||
<body> |
||||
<div id="app"></div> |
||||
<script type="module" src="/src/main.ts"></script> |
||||
<script type="text/javascript"> |
||||
document.addEventListener('uniAppJsBridgeReady', function () { |
||||
document.querySelector('.btn-list').addEventlistener('click', function (evt) { |
||||
var target = evt.target |
||||
if (target.tagName === 'BUTTON') { |
||||
var action = target.getAttribute('data-action') |
||||
switch (action) { |
||||
case 'navigateBack': |
||||
uni.navigateBack({ |
||||
delta: 1 |
||||
}) |
||||
break |
||||
default: |
||||
uni[action]({ |
||||
url: '/pages/index' |
||||
}) |
||||
break |
||||
} |
||||
} |
||||
}) |
||||
}) |
||||
</script> |
||||
</body> |
||||
</html> |
@ -0,0 +1,76 @@
|
||||
{ |
||||
"name": "web", |
||||
"version": "v1.0.0", |
||||
"private": true, |
||||
"scripts": { |
||||
"dev": "vite", |
||||
"build": "set NODE_OPTIONS=--max_old_space_size=4096 && run-p type-check build-only", |
||||
"preview": "vite preview", |
||||
"test:unit": "vitest", |
||||
"build-only": "vite build", |
||||
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false", |
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", |
||||
"format": "prettier --write src/" |
||||
}, |
||||
"dependencies": { |
||||
"@antv/layout": "^0.3.1", |
||||
"@codemirror/theme-one-dark": "^6.1.2", |
||||
"@ctrl/tinycolor": "^4.1.0", |
||||
"@logicflow/core": "^1.2.27", |
||||
"@logicflow/extension": "^1.2.27", |
||||
"@vueuse/core": "^10.9.0", |
||||
"@wecom/jssdk": "^2.1.0", |
||||
"axios": "^0.28.0", |
||||
"codemirror": "^6.0.1", |
||||
"cropperjs": "^1.6.2", |
||||
"echarts": "^5.5.0", |
||||
"element-plus": "^2.9.1", |
||||
"file-saver": "^2.0.5", |
||||
"highlight.js": "^11.9.0", |
||||
"install": "^0.13.0", |
||||
"katex": "^0.16.10", |
||||
"lodash": "^4.17.21", |
||||
"marked": "^12.0.2", |
||||
"md-editor-v3": "^4.16.7", |
||||
"medium-zoom": "^1.1.0", |
||||
"mermaid": "^10.9.0", |
||||
"mitt": "^3.0.0", |
||||
"moment": "^2.30.1", |
||||
"npm": "^10.2.4", |
||||
"nprogress": "^0.2.0", |
||||
"pinia": "^2.1.6", |
||||
"pinyin-pro": "^3.18.2", |
||||
"recorder-core": "^1.3.24040900", |
||||
"screenfull": "^6.0.2", |
||||
"use-element-plus-theme": "^0.0.5", |
||||
"vue": "^3.3.4", |
||||
"vue-clipboard3": "^2.0.0", |
||||
"vue-codemirror": "^6.1.1", |
||||
"vue-i18n": "^9.13.1", |
||||
"vue-router": "^4.2.4" |
||||
}, |
||||
"devDependencies": { |
||||
"@rushstack/eslint-patch": "^1.3.2", |
||||
"@tsconfig/node18": "^18.2.0", |
||||
"@types/file-saver": "^2.0.7", |
||||
"@types/jsdom": "^21.1.1", |
||||
"@types/node": "^18.17.5", |
||||
"@types/nprogress": "^0.2.0", |
||||
"@vitejs/plugin-vue": "^4.3.1", |
||||
"@vue/eslint-config-prettier": "^8.0.0", |
||||
"@vue/eslint-config-typescript": "^11.0.3", |
||||
"@vue/test-utils": "^2.4.1", |
||||
"@vue/tsconfig": "^0.4.0", |
||||
"eslint": "^8.46.0", |
||||
"eslint-plugin-vue": "^9.16.1", |
||||
"jsdom": "^22.1.0", |
||||
"npm-run-all": "^4.1.5", |
||||
"prettier": "^3.0.0", |
||||
"sass": "1.66.1", |
||||
"typescript": "~5.1.6", |
||||
"unplugin-vue-define-options": "^1.3.18", |
||||
"vite": "^4.4.9", |
||||
"vitest": "^0.34.2", |
||||
"vue-tsc": "^1.8.8" |
||||
} |
||||
} |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 254 KiB |
After Width: | Height: | Size: 8.0 KiB |
@ -0,0 +1 @@
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E})); |
@ -0,0 +1,7 @@
|
||||
<script setup lang="ts"></script> |
||||
|
||||
<template> |
||||
<router-view /> |
||||
</template> |
||||
|
||||
<style scoped></style> |
@ -0,0 +1,90 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
|
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/application' |
||||
|
||||
/** |
||||
* API_KEY列表 |
||||
* @param 参数 application_id |
||||
*/ |
||||
const getAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
application_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${application_id}/api_key`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 新增API_KEY |
||||
* @param 参数 application_id |
||||
*/ |
||||
const postAPIKey: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
application_id, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/${application_id}/api_key`, {}, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除API_KEY |
||||
* @param 参数 application_id api_key_id |
||||
*/ |
||||
const delAPIKey: ( |
||||
application_id: String, |
||||
api_key_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (application_id, api_key_id, loading) => { |
||||
return del(`${prefix}/${application_id}/api_key/${api_key_id}`, undefined, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改API_KEY |
||||
* @param 参数 application_id,api_key_id |
||||
* data { |
||||
* is_active: boolean |
||||
* } |
||||
*/ |
||||
const putAPIKey: ( |
||||
application_id: string, |
||||
api_key_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, api_key_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}/api_key/${api_key_id}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 统计 |
||||
* @param 参数 application_id, data |
||||
*/ |
||||
const getStatistics: ( |
||||
application_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return get(`${prefix}/${application_id}/statistics/chat_record_aggregate_trend`, data, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改应用icon |
||||
* @param 参数 application_id |
||||
* data: file |
||||
*/ |
||||
const putAppIcon: ( |
||||
application_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}/edit_icon`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getAPIKey, |
||||
postAPIKey, |
||||
delAPIKey, |
||||
putAPIKey, |
||||
getStatistics, |
||||
putAppIcon |
||||
} |
@ -0,0 +1,41 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, put } from '@/request/index' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/application' |
||||
|
||||
/** |
||||
* 替换社区版-获取AccessToken |
||||
* @param 参数 application_id |
||||
*/ |
||||
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
application_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${application_id}/setting`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 替换社区版-修改AccessToken |
||||
* @param 参数 application_id |
||||
* data { |
||||
* "show_source": boolean, |
||||
* "show_history": boolean, |
||||
* "draggable": boolean, |
||||
* "show_guide": boolean, |
||||
* "avatar": file, |
||||
* "float_icon": file, |
||||
* } |
||||
*/ |
||||
const putAccessToken: ( |
||||
application_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}/setting`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getAccessToken, |
||||
putAccessToken |
||||
} |
@ -0,0 +1,580 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, postStream, del, put, request, download, exportFile } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import type { ApplicationFormType } from '@/api/type/application' |
||||
import { type Ref } from 'vue' |
||||
import type { FormField } from '@/components/dynamics-form/type' |
||||
|
||||
const prefix = '/application' |
||||
|
||||
/** |
||||
* 获取全部应用 |
||||
* @param 参数 |
||||
*/ |
||||
const getAllAppilcation: () => Promise<Result<any[]>> = () => { |
||||
return get(`${prefix}`) |
||||
} |
||||
|
||||
/** |
||||
* 获取分页应用 |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"name": "string", |
||||
} |
||||
*/ |
||||
const getApplication: ( |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (page, param, loading) => { |
||||
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建应用 |
||||
* @param 参数 |
||||
*/ |
||||
const postApplication: ( |
||||
data: ApplicationFormType, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (data, loading) => { |
||||
return post(`${prefix}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改应用 |
||||
* @param 参数 |
||||
*/ |
||||
const putApplication: ( |
||||
application_id: String, |
||||
data: ApplicationFormType, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除应用 |
||||
* @param 参数 application_id |
||||
*/ |
||||
const delApplication: ( |
||||
application_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (application_id, loading) => { |
||||
return del(`${prefix}/${application_id}`, undefined, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 应用详情 |
||||
* @param 参数 application_id |
||||
*/ |
||||
const getApplicationDetail: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得当前应用可使用的知识库 |
||||
* @param 参数 application_id |
||||
*/ |
||||
const getApplicationDataset: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/list_dataset`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取AccessToken |
||||
* @param 参数 application_id |
||||
*/ |
||||
const getAccessToken: (application_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
application_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${application_id}/access_token`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改AccessToken |
||||
* @param 参数 application_id |
||||
* data { |
||||
* "is_active": true |
||||
* } |
||||
*/ |
||||
const putAccessToken: ( |
||||
application_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}/access_token`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 应用认证 |
||||
* @param 参数 |
||||
{ |
||||
"access_token": "string" |
||||
} |
||||
*/ |
||||
const postAppAuthentication: ( |
||||
access_token: string, |
||||
loading?: Ref<boolean>, |
||||
authentication_value?: any |
||||
) => Promise<any> = (access_token, loading, authentication_value) => { |
||||
return post( |
||||
`${prefix}/authentication`, |
||||
{ access_token: access_token, authentication_value }, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 对话获取应用相关信息 |
||||
* @param 参数 |
||||
{ |
||||
"access_token": "string" |
||||
} |
||||
*/ |
||||
const getAppProfile: (loading?: Ref<boolean>) => Promise<any> = (loading) => { |
||||
return get(`${prefix}/profile`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得临时回话Id |
||||
* @param 参数 |
||||
|
||||
} |
||||
*/ |
||||
const postChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => { |
||||
return post(`${prefix}/chat/open`, data) |
||||
} |
||||
|
||||
/** |
||||
* 获得工作流临时回话Id |
||||
* @param 参数 |
||||
|
||||
} |
||||
*/ |
||||
const postWorkflowChatOpen: (data: ApplicationFormType) => Promise<Result<any>> = (data) => { |
||||
return post(`${prefix}/chat_workflow/open`, data) |
||||
} |
||||
|
||||
/** |
||||
* 正式回话Id |
||||
* @param 参数 |
||||
* { |
||||
"model_id": "string", |
||||
"multiple_rounds_dialogue": true, |
||||
"dataset_id_list": [ |
||||
"string" |
||||
] |
||||
} |
||||
*/ |
||||
const getChatOpen: (application_id: String) => Promise<Result<any>> = (application_id) => { |
||||
return get(`${prefix}/${application_id}/chat/open`) |
||||
} |
||||
/** |
||||
* 对话 |
||||
* @param 参数 |
||||
* chat_id: string |
||||
* data |
||||
*/ |
||||
const postChatMessage: (chat_id: string, data: any) => Promise<any> = (chat_id, data) => { |
||||
return postStream(`/api${prefix}/chat_message/${chat_id}`, data) |
||||
} |
||||
|
||||
/** |
||||
* 点赞、点踩 |
||||
* @param 参数 |
||||
* application_id : string; chat_id : string; chat_record_id : string |
||||
* { |
||||
"vote_status": "string", // -1 0 1
|
||||
} |
||||
*/ |
||||
const putChatVote: ( |
||||
application_id: string, |
||||
chat_id: string, |
||||
chat_record_id: string, |
||||
vote_status: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<any> = (application_id, chat_id, chat_record_id, vote_status, loading) => { |
||||
return put( |
||||
`${prefix}/${application_id}/chat/${chat_id}/chat_record/${chat_record_id}/vote`, |
||||
{ |
||||
vote_status |
||||
}, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 命中测试列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getApplicationHitTest: ( |
||||
application_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, data, loading) => { |
||||
return get(`${prefix}/${application_id}/hit_test`, data, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户可使用的模型列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getApplicationModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户可使用的模型列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getApplicationRerankerModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'RERANKER' }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户可使用的模型列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getApplicationSTTModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'STT' }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户可使用的模型列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getApplicationTTSModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'TTS' }, loading) |
||||
} |
||||
|
||||
const getApplicationImageModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'IMAGE' }, loading) |
||||
} |
||||
|
||||
const getApplicationTTIModel: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model`, { model_type: 'TTI' }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 发布应用 |
||||
* @param 参数 |
||||
*/ |
||||
const putPublishApplication: ( |
||||
application_id: String, |
||||
data: ApplicationFormType, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return put(`${prefix}/${application_id}/publish`, data, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取应用所属的函数库列表 |
||||
* @param application_id 应用id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const listFunctionLib: (application_id: String, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
application_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${application_id}/function_lib`, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取当前人的所有应用列表 |
||||
* @param application_id 应用id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
export const getApplicationList: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, loading) => { |
||||
return get(`${prefix}/${application_id}/application`, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取应用所属的函数库 |
||||
* @param application_id |
||||
* @param function_lib_id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const getFunctionLib: ( |
||||
application_id: String, |
||||
function_lib_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, function_lib_id, loading) => { |
||||
return get(`${prefix}/${application_id}/function_lib/${function_lib_id}`, undefined, loading) |
||||
} |
||||
|
||||
const getApplicationById: ( |
||||
application_id: String, |
||||
app_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, app_id, loading) => { |
||||
return get(`${prefix}/${application_id}/application/${app_id}`, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取模型参数表单 |
||||
* @param application_id 应用id |
||||
* @param model_id 模型id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const getModelParamsForm: ( |
||||
application_id: String, |
||||
model_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<FormField>>> = (application_id, model_id, loading) => { |
||||
return get(`${prefix}/${application_id}/model_params_form/${model_id}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 上传文档图片附件 |
||||
*/ |
||||
const uploadFile: ( |
||||
application_id: String, |
||||
chat_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, chat_id, data, loading) => { |
||||
return post(`${prefix}/${application_id}/chat/${chat_id}/upload_file`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 语音转文本 |
||||
*/ |
||||
const postSpeechToText: ( |
||||
application_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return post(`${prefix}/${application_id}/speech_to_text`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 文本转语音 |
||||
*/ |
||||
const postTextToSpeech: ( |
||||
application_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return download(`${prefix}/${application_id}/text_to_speech`, 'post', data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 播放测试文本 |
||||
*/ |
||||
const playDemoText: ( |
||||
application_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, data, loading) => { |
||||
return download(`${prefix}/${application_id}/play_demo_text`, 'post', data, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取平台状态 |
||||
*/ |
||||
const getPlatformStatus: (application_id: string) => Promise<Result<any>> = (application_id) => { |
||||
return get(`/platform/${application_id}/status`) |
||||
} |
||||
/** |
||||
* 获取平台配置 |
||||
*/ |
||||
const getPlatformConfig: (application_id: string, type: string) => Promise<Result<any>> = ( |
||||
application_id, |
||||
type |
||||
) => { |
||||
return get(`/platform/${application_id}/${type}`) |
||||
} |
||||
/** |
||||
* 更新平台配置 |
||||
*/ |
||||
const updatePlatformConfig: ( |
||||
application_id: string, |
||||
type: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, type, data, loading) => { |
||||
return post(`/platform/${application_id}/${type}`, data, undefined, loading) |
||||
} |
||||
/** |
||||
* 更新平台状态 |
||||
*/ |
||||
const updatePlatformStatus: (application_id: string, data: any) => Promise<Result<any>> = ( |
||||
application_id, |
||||
data |
||||
) => { |
||||
return post(`/platform/${application_id}/status`, data) |
||||
} |
||||
/** |
||||
* 验证密码 |
||||
*/ |
||||
const validatePassword: ( |
||||
application_id: string, |
||||
password: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, password, loading) => { |
||||
return get(`/application/${application_id}/auth/${password}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* workflow历史版本 |
||||
*/ |
||||
const getWorkFlowVersion: ( |
||||
application_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, loading) => { |
||||
return get(`/application/${application_id}/work_flow_version`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* workflow历史版本详情 |
||||
*/ |
||||
const getWorkFlowVersionDetail: ( |
||||
application_id: string, |
||||
application_version_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, application_version_id, loading) => { |
||||
return get( |
||||
`/application/${application_id}/work_flow_version/${application_version_id}`, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* 修改workflow历史版本 |
||||
*/ |
||||
const putWorkFlowVersion: ( |
||||
application_id: string, |
||||
application_version_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, application_version_id, data, loading) => { |
||||
return put( |
||||
`/application/${application_id}/work_flow_version/${application_version_id}`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const getUserList: (type: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
type, |
||||
loading |
||||
) => { |
||||
return get(`/user/list/${type}`, undefined, loading) |
||||
} |
||||
|
||||
const exportApplication = ( |
||||
application_id: string, |
||||
application_name: string, |
||||
loading?: Ref<boolean> |
||||
) => { |
||||
return exportFile( |
||||
application_name + '.mk', |
||||
`/application/${application_id}/export`, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 导入应用 |
||||
*/ |
||||
const importApplication: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/import`, data, undefined, loading) |
||||
} |
||||
export default { |
||||
getAllAppilcation, |
||||
getApplication, |
||||
postApplication, |
||||
putApplication, |
||||
postChatOpen, |
||||
getChatOpen, |
||||
postChatMessage, |
||||
delApplication, |
||||
getApplicationDetail, |
||||
getApplicationDataset, |
||||
getAccessToken, |
||||
putAccessToken, |
||||
postAppAuthentication, |
||||
getAppProfile, |
||||
putChatVote, |
||||
getApplicationHitTest, |
||||
getApplicationModel, |
||||
putPublishApplication, |
||||
postWorkflowChatOpen, |
||||
listFunctionLib, |
||||
getFunctionLib, |
||||
getModelParamsForm, |
||||
getApplicationRerankerModel, |
||||
getApplicationSTTModel, |
||||
getApplicationTTSModel, |
||||
getApplicationImageModel, |
||||
getApplicationTTIModel, |
||||
postSpeechToText, |
||||
postTextToSpeech, |
||||
getPlatformStatus, |
||||
getPlatformConfig, |
||||
updatePlatformConfig, |
||||
updatePlatformStatus, |
||||
validatePassword, |
||||
getWorkFlowVersion, |
||||
getWorkFlowVersionDetail, |
||||
putWorkFlowVersion, |
||||
playDemoText, |
||||
getUserList, |
||||
getApplicationList, |
||||
uploadFile, |
||||
exportApplication, |
||||
importApplication, |
||||
getApplicationById |
||||
} |
@ -0,0 +1,39 @@
|
||||
import {Result} from '@/request/Result' |
||||
import {get, post, del, put} from '@/request/index' |
||||
import type {pageRequest} from '@/api/type/common' |
||||
import {type Ref} from 'vue' |
||||
|
||||
const prefix = '/auth' |
||||
/** |
||||
* 获取认证设置 |
||||
*/ |
||||
const getAuthSetting: (auth_type: string, loading?: Ref<boolean>) => Promise<Result<any>> = (auth_type, loading) => { |
||||
return get(`${prefix}/${auth_type}/detail`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 邮箱测试 |
||||
*/ |
||||
const postAuthSetting: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/connection`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改邮箱设置 |
||||
*/ |
||||
const putAuthSetting: (auth_type: string, data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
auth_type, |
||||
data, |
||||
loading |
||||
) => { |
||||
return put(`${prefix}/${auth_type}/info`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getAuthSetting, |
||||
postAuthSetting, |
||||
putAuthSetting |
||||
} |
@ -0,0 +1,249 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put, exportExcel, exportFile } from '@/request/index' |
||||
import type { datasetData } from '@/api/type/dataset' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import type { ApplicationFormType } from '@/api/type/application' |
||||
import { type Ref } from 'vue' |
||||
const prefix = '/dataset' |
||||
|
||||
/** |
||||
* 获取分页知识库 |
||||
* @param 参数
|
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"name": "string", |
||||
} |
||||
*/ |
||||
const getDataset: ( |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (page, param, loading) => { |
||||
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取全部知识库 |
||||
* @param 参数 |
||||
*/ |
||||
const getAllDataset: (loading?: Ref<boolean>) => Promise<Result<any[]>> = (loading) => { |
||||
return get(`${prefix}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除知识库 |
||||
* @param 参数 dataset_id |
||||
*/ |
||||
const delDataset: (dataset_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
dataset_id, |
||||
loading |
||||
) => { |
||||
return del(`${prefix}/${dataset_id}`, undefined, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建知识库 |
||||
* @param 参数
|
||||
* { |
||||
"name": "string", |
||||
"desc": "string", |
||||
"documents": [ |
||||
{ |
||||
"name": "string", |
||||
"paragraphs": [ |
||||
{ |
||||
"content": "string", |
||||
"title": "string", |
||||
"problem_list": [ |
||||
{ |
||||
"id": "string", |
||||
"content": "string" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
*/ |
||||
const postDataset: (data: datasetData, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}`, data, undefined, loading, 1000 * 60 * 5) |
||||
} |
||||
|
||||
/** |
||||
* 创建Web知识库 |
||||
* @param 参数
|
||||
* { |
||||
"name": "string", |
||||
"desc": "string", |
||||
"source_url": "string", |
||||
"selector": "string", |
||||
} |
||||
*/ |
||||
const postWebDataset: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/web`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建QA知识库 |
||||
* @param 参数 formData |
||||
* { |
||||
"file": "file", |
||||
"name": "string", |
||||
"desc": "string", |
||||
} |
||||
*/ |
||||
const postQADataset: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/qa`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 知识库详情 |
||||
* @param 参数 dataset_id |
||||
*/ |
||||
const getDatasetDetail: (dataset_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
dataset_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${dataset_id}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改知识库信息 |
||||
* @param 参数
|
||||
* dataset_id |
||||
* { |
||||
"name": "string", |
||||
"desc": true |
||||
} |
||||
*/ |
||||
const putDataset: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return put(`${prefix}/${dataset_id}`, data, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取知识库 可关联的应用列表 |
||||
* @param dataset_id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const listUsableApplication: ( |
||||
dataset_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<ApplicationFormType>>> = (dataset_id, loading) => { |
||||
return get(`${prefix}/${dataset_id}/application`, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 命中测试列表 |
||||
* @param dataset_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getDatasetHitTest: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (dataset_id, data, loading) => { |
||||
return get(`${prefix}/${dataset_id}/hit_test`, data, loading) |
||||
} |
||||
|
||||
/** |
||||
* 同步知识库 |
||||
* @param 参数 dataset_id |
||||
* @query 参数 sync_type // 同步类型->replace:替换同步,complete:完整同步
|
||||
*/ |
||||
const putSyncWebDataset: ( |
||||
dataset_id: string, |
||||
sync_type: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, sync_type, loading) => { |
||||
return put(`${prefix}/${dataset_id}/sync_web`, undefined, { sync_type }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 向量化知识库 |
||||
* @param 参数 dataset_id |
||||
*/ |
||||
const putReEmbeddingDataset: ( |
||||
dataset_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, loading) => { |
||||
return put(`${prefix}/${dataset_id}/re_embedding`, undefined, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 导出知识库 |
||||
* @param dataset_name 知识库名称 |
||||
* @param dataset_id 知识库id |
||||
* @returns |
||||
*/ |
||||
const exportDataset: ( |
||||
dataset_name: string, |
||||
dataset_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<any> = (dataset_name, dataset_id, loading) => { |
||||
return exportExcel(dataset_name + '.xlsx', `dataset/${dataset_id}/export`, undefined, loading) |
||||
} |
||||
/** |
||||
*导出Zip知识库 |
||||
* @param dataset_name 知识库名称 |
||||
* @param dataset_id 知识库id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const exportZipDataset: ( |
||||
dataset_name: string, |
||||
dataset_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<any> = (dataset_name, dataset_id, loading) => { |
||||
return exportFile(dataset_name + '.zip', `dataset/${dataset_id}/export_zip`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取当前用户可使用的模型列表 |
||||
* @param application_id |
||||
* @param loading |
||||
* @query { query_text: string, top_number: number, similarity: number } |
||||
* @returns |
||||
*/ |
||||
const getDatasetModel: ( |
||||
dataset_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any>>> = (dataset_id, loading) => { |
||||
return get(`${prefix}/${dataset_id}/model`, loading) |
||||
} |
||||
|
||||
export default { |
||||
getDataset, |
||||
getAllDataset, |
||||
delDataset, |
||||
postDataset, |
||||
getDatasetDetail, |
||||
putDataset, |
||||
listUsableApplication, |
||||
getDatasetHitTest, |
||||
postWebDataset, |
||||
putSyncWebDataset, |
||||
putReEmbeddingDataset, |
||||
postQADataset, |
||||
exportDataset, |
||||
getDatasetModel, |
||||
exportZipDataset |
||||
} |
@ -0,0 +1,398 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put, exportExcel, exportFile } from '@/request/index' |
||||
import type { Ref } from 'vue' |
||||
import type { KeyValue } from '@/api/type/common' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
|
||||
const prefix = '/dataset' |
||||
|
||||
/** |
||||
* 分段预览(上传文档) |
||||
* @param 参数 file:file,limit:number,patterns:array,with_filter:boolean |
||||
*/ |
||||
const postSplitDocument: (data: any) => Promise<Result<any>> = (data) => { |
||||
return post(`${prefix}/document/split`, data, undefined, undefined, 1000 * 60 * 60) |
||||
} |
||||
|
||||
/** |
||||
* 分段标识列表 |
||||
* @param loading 加载器 |
||||
* @returns 分段标识列表 |
||||
*/ |
||||
const listSplitPattern: ( |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<KeyValue<string, string>>>> = (loading) => { |
||||
return get(`${prefix}/document/split_pattern`, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 文档分页列表 |
||||
* @param 参数 dataset_id, |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"name": "string", |
||||
} |
||||
*/ |
||||
|
||||
const getDocument: ( |
||||
dataset_id: string, |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, page, param, loading) => { |
||||
return get( |
||||
`${prefix}/${dataset_id}/document/${page.current_page}/${page.page_size}`, |
||||
param, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const getAllDocument: (dataset_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
dataset_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${dataset_id}/document`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建批量文档 |
||||
* @param 参数 |
||||
* { |
||||
"name": "string", |
||||
"paragraphs": [ |
||||
{ |
||||
"content": "string", |
||||
"title": "string", |
||||
"problem_list": [ |
||||
{ |
||||
"id": "string", |
||||
"content": "string" |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
*/ |
||||
const postDocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/document/_bach`, data, {}, loading, 1000 * 60 * 5) |
||||
} |
||||
|
||||
/** |
||||
* 修改文档 |
||||
* @param 参数 |
||||
* dataset_id, document_id, |
||||
* { |
||||
"name": "string", |
||||
"is_active": true, |
||||
"meta": {} |
||||
} |
||||
*/ |
||||
const putDocument: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, data: any, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/${document_id}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除文档 |
||||
* @param 参数 dataset_id, document_id, |
||||
*/ |
||||
const delDocument: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, loading) => { |
||||
return del(`${prefix}/${dataset_id}/document/${document_id}`, loading) |
||||
} |
||||
/** |
||||
* 批量删除文档 |
||||
* @param 参数 dataset_id, |
||||
*/ |
||||
const delMulDocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return del(`${prefix}/${dataset_id}/document/_bach`, undefined, { id_list: data }, loading) |
||||
} |
||||
|
||||
const batchRefresh: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
stateList: Array<string>, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, stateList, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/batch_refresh`, |
||||
{ id_list: data, state_list: stateList }, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* 文档详情 |
||||
* @param 参数 dataset_id |
||||
*/ |
||||
const getDocumentDetail: (dataset_id: string, document_id: string) => Promise<Result<any>> = ( |
||||
dataset_id, |
||||
document_id |
||||
) => { |
||||
return get(`${prefix}/${dataset_id}/document/${document_id}`) |
||||
} |
||||
|
||||
/** |
||||
* 刷新文档向量库 |
||||
* @param 参数 |
||||
* dataset_id, document_id, |
||||
*/ |
||||
const putDocumentRefresh: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
state_list: Array<string>, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, state_list, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/refresh`, |
||||
{ state_list }, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 同步web站点类型 |
||||
* @param 参数 |
||||
* dataset_id, document_id, |
||||
*/ |
||||
const putDocumentSync: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/${document_id}/sync`, undefined, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 批量同步文档 |
||||
* @param 参数 dataset_id, |
||||
*/ |
||||
const delMulSyncDocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/_bach`, { id_list: data }, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建Web站点文档 |
||||
* @param 参数 |
||||
* { |
||||
"source_url_list": [ |
||||
"string" |
||||
], |
||||
"selector": "string" |
||||
} |
||||
} |
||||
*/ |
||||
const postWebDocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/document/web`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 导入QA文档 |
||||
* @param 参数 |
||||
* file |
||||
} |
||||
*/ |
||||
const postQADocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/document/qa`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 导入表格 |
||||
* @param 参数 |
||||
* file |
||||
*/ |
||||
const postTableDocument: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/document/table`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 批量迁移文档 |
||||
* @param 参数 dataset_id,target_dataset_id, |
||||
*/ |
||||
const putMigrateMulDocument: ( |
||||
dataset_id: string, |
||||
target_dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, target_dataset_id, data, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/migrate/${target_dataset_id}`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 批量修改命中方式 |
||||
* @param dataset_id 知识库id |
||||
* @param data {id_list:[],hit_handling_method:'directly_return|optimization'} |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const batchEditHitHandling: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/batch_hit_handling`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得QA模版 |
||||
* @param 参数 fileName,type, |
||||
*/ |
||||
const exportQATemplate: (fileName: string, type: string, loading?: Ref<boolean>) => void = ( |
||||
fileName, |
||||
type, |
||||
loading |
||||
) => { |
||||
return exportExcel(fileName, `${prefix}/document/template/export`, { type }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得table模版 |
||||
* @param 参数 fileName,type, |
||||
*/ |
||||
const exportTableTemplate: (fileName: string, type: string, loading?: Ref<boolean>) => void = ( |
||||
fileName, |
||||
type, |
||||
loading |
||||
) => { |
||||
return exportExcel(fileName, `${prefix}/document/table_template/export`, { type }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 导出文档 |
||||
* @param document_name 文档名称 |
||||
* @param dataset_id 数据集id |
||||
* @param document_id 文档id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const exportDocument: ( |
||||
document_name: string, |
||||
dataset_id: string, |
||||
document_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<any> = (document_name, dataset_id, document_id, loading) => { |
||||
return exportExcel( |
||||
document_name + '.xlsx', |
||||
`${prefix}/${dataset_id}/document/${document_id}/export`, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* 导出文档 |
||||
* @param document_name 文档名称 |
||||
* @param dataset_id 数据集id |
||||
* @param document_id 文档id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const exportDocumentZip: ( |
||||
document_name: string, |
||||
dataset_id: string, |
||||
document_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<any> = (document_name, dataset_id, document_id, loading) => { |
||||
return exportFile( |
||||
document_name + '.zip', |
||||
`${prefix}/${dataset_id}/document/${document_id}/export_zip`, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
const batchGenerateRelated: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/batch_generate_related`, data, undefined, loading) |
||||
} |
||||
|
||||
const cancelTask: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/cancel_task`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const batchCancelTask: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return put(`${prefix}/${dataset_id}/document/cancel_task/_batch`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
postSplitDocument, |
||||
getDocument, |
||||
getAllDocument, |
||||
postDocument, |
||||
putDocument, |
||||
delDocument, |
||||
delMulDocument, |
||||
getDocumentDetail, |
||||
listSplitPattern, |
||||
putDocumentRefresh, |
||||
putDocumentSync, |
||||
delMulSyncDocument, |
||||
postWebDocument, |
||||
putMigrateMulDocument, |
||||
batchEditHitHandling, |
||||
exportQATemplate, |
||||
exportTableTemplate, |
||||
postQADocument, |
||||
postTableDocument, |
||||
exportDocument, |
||||
batchRefresh, |
||||
batchGenerateRelated, |
||||
cancelTask, |
||||
exportDocumentZip, |
||||
batchCancelTask |
||||
} |
@ -0,0 +1,38 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/email_setting' |
||||
/** |
||||
* 获取邮箱设置 |
||||
*/ |
||||
const getEmailSetting: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get(`${prefix}`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 邮箱测试 |
||||
*/ |
||||
const postTestEmail: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改邮箱设置 |
||||
*/ |
||||
const putEmailSetting: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return put(`${prefix}`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getEmailSetting, |
||||
postTestEmail, |
||||
putEmailSetting |
||||
} |
@ -0,0 +1,111 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import type { functionLibData } from '@/api/type/function-lib' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/function_lib' |
||||
|
||||
/** |
||||
* 获取函数列表 |
||||
* param { |
||||
"name": "string", |
||||
} |
||||
*/ |
||||
const getAllFunctionLib: (param?: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
param, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}`, param || {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取分页函数列表 |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"name": "string", |
||||
} |
||||
*/ |
||||
const getFunctionLib: ( |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (page, param, loading) => { |
||||
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建函数 |
||||
* @param 参数 |
||||
*/ |
||||
const postFunctionLib: (data: functionLibData, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改函数 |
||||
* @param 参数
|
||||
|
||||
*/ |
||||
const putFunctionLib: ( |
||||
function_lib_id: string, |
||||
data: functionLibData, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (function_lib_id, data, loading) => { |
||||
return put(`${prefix}/${function_lib_id}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 调试函数 |
||||
* @param 参数
|
||||
|
||||
*/ |
||||
const postFunctionLibDebug: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data: any, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/debug`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除函数 |
||||
* @param 参数 function_lib_id |
||||
*/ |
||||
const delFunctionLib: ( |
||||
function_lib_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (function_lib_id, loading) => { |
||||
return del(`${prefix}/${function_lib_id}`, undefined, {}, loading) |
||||
} |
||||
/** |
||||
* 获取函数详情 |
||||
* @param function_lib_id 函数id |
||||
* @param loading 加载器 |
||||
* @returns 函数详情 |
||||
*/ |
||||
const getFunctionLibById: ( |
||||
function_lib_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (function_lib_id, loading) => { |
||||
return get(`${prefix}/${function_lib_id}`, undefined, loading) |
||||
} |
||||
const pylint: (code: string, loading?: Ref<boolean>) => Promise<Result<any>> = (code, loading) => { |
||||
return post(`${prefix}/pylint`, { code }, {}, loading) |
||||
} |
||||
|
||||
export default { |
||||
getFunctionLib, |
||||
postFunctionLib, |
||||
putFunctionLib, |
||||
postFunctionLibDebug, |
||||
getAllFunctionLib, |
||||
delFunctionLib, |
||||
getFunctionLibById, |
||||
pylint |
||||
} |
@ -0,0 +1,15 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
|
||||
const prefix = '/image' |
||||
/** |
||||
* 上传图片 |
||||
* @param 参数 file:file |
||||
*/ |
||||
const postImage: (data: any) => Promise<Result<any>> = (data) => { |
||||
return post(`${prefix}`, data) |
||||
} |
||||
|
||||
export default { |
||||
postImage |
||||
} |
@ -0,0 +1,24 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/license' |
||||
|
||||
/** |
||||
* 获得license信息 |
||||
*/ |
||||
const getLicense: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get(`${prefix}/profile`, undefined, loading) |
||||
} |
||||
/** |
||||
* 更新license信息 |
||||
* @param 参数 license_file:file |
||||
*/ |
||||
const putLicense: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = (data, loading) => { |
||||
return put(`${prefix}/profile`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getLicense, |
||||
putLicense |
||||
} |
@ -0,0 +1,235 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, del, put, exportExcel, exportExcelPost, post } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/application' |
||||
/** |
||||
* 对话日志 |
||||
* @param 参数 |
||||
* application_id, history_day |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"history_day": "string", |
||||
"search": "string", |
||||
} |
||||
*/ |
||||
const getChatLog: ( |
||||
application_id: String, |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, page, param, loading) => { |
||||
return get( |
||||
`${prefix}/${application_id}/chat/${page.current_page}/${page.page_size}`, |
||||
param, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const exportChatLog: ( |
||||
application_id: string, |
||||
application_name: string, |
||||
param: any, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => void = (application_id, application_name, param, data, loading) => { |
||||
exportExcelPost( |
||||
application_name + '.xlsx', |
||||
`${prefix}/${application_id}/chat/export`, |
||||
param, |
||||
data, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 删除日志 |
||||
* @param 参数 application_id, chat_id, |
||||
*/ |
||||
const delChatLog: ( |
||||
application_id: string, |
||||
chat_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (application_id, chat_id, loading) => { |
||||
return del(`${prefix}/${application_id}/chat/${chat_id}`, undefined, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 日志记录 |
||||
* @param 参数 |
||||
* application_id, chart_id |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
*/ |
||||
const getChatRecordLog: ( |
||||
application_id: String, |
||||
chart_id: String, |
||||
page: pageRequest, |
||||
loading?: Ref<boolean>, |
||||
order_asc?: boolean |
||||
) => Promise<Result<any>> = (application_id, chart_id, page, loading, order_asc) => { |
||||
return get( |
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${page.current_page}/${page.page_size}`, |
||||
{ order_asc: order_asc !== undefined ? order_asc : true }, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 修改日志内容 |
||||
* @param 参数 |
||||
* application_id, chart_id, chart_record_id, dataset_id, document_id |
||||
* data { |
||||
"title": "string", |
||||
"content": "string", |
||||
} |
||||
*/ |
||||
const putChatRecordLog: ( |
||||
application_id: String, |
||||
chart_id: String, |
||||
chart_record_id: String, |
||||
dataset_id: String, |
||||
document_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = ( |
||||
application_id, |
||||
chart_id, |
||||
chart_record_id, |
||||
dataset_id, |
||||
document_id, |
||||
data, |
||||
loading |
||||
) => { |
||||
return put( |
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/dataset/${dataset_id}/document_id/${document_id}/improve`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* 对话记录提交至知识库 |
||||
* @param data |
||||
* @param loading |
||||
* @param application_id |
||||
* @param dataset_id |
||||
*/ |
||||
|
||||
const postChatRecordLog: ( |
||||
application_id: string, |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, dataset_id, data, loading) => { |
||||
return post(`${prefix}/${application_id}/dataset/${dataset_id}/improve`, data, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取标注段落列表信息 |
||||
* @param 参数 |
||||
* application_id, chart_id, chart_record_id |
||||
*/ |
||||
const getMarkRecord: ( |
||||
application_id: String, |
||||
chart_id: String, |
||||
chart_record_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, chart_id, chart_record_id, loading) => { |
||||
return get( |
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/improve`, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 删除标注 |
||||
* @param 参数 |
||||
* application_id, chart_id, chart_record_id, dataset_id, document_id,paragraph_id |
||||
*/ |
||||
const delMarkRecord: ( |
||||
application_id: String, |
||||
chart_id: String, |
||||
chart_record_id: String, |
||||
dataset_id: String, |
||||
document_id: String, |
||||
paragraph_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = ( |
||||
application_id, |
||||
chart_id, |
||||
chart_record_id, |
||||
dataset_id, |
||||
document_id, |
||||
paragraph_id, |
||||
loading |
||||
) => { |
||||
return del( |
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}/dataset/${dataset_id}/document_id/${document_id}/improve/${paragraph_id}`, |
||||
undefined, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 获取对话记录详情 |
||||
* @param 参数 |
||||
* application_id, chart_id, chart_record_id |
||||
*/ |
||||
const getRecordDetail: ( |
||||
application_id: String, |
||||
chart_id: String, |
||||
chart_record_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, chart_id, chart_record_id, loading) => { |
||||
return get( |
||||
`${prefix}/${application_id}/chat/${chart_id}/chat_record/${chart_record_id}`, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const getChatLogClient: ( |
||||
application_id: String, |
||||
page: pageRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (application_id, page, loading) => { |
||||
return get( |
||||
`${prefix}/${application_id}/chat/client/${page.current_page}/${page.page_size}`, |
||||
null, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 客户端删除日志 |
||||
* @param 参数 application_id, chat_id, |
||||
*/ |
||||
const delChatClientLog: ( |
||||
application_id: string, |
||||
chat_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (application_id, chat_id, loading) => { |
||||
return del(`${prefix}/${application_id}/chat/client/${chat_id}`, undefined, {}, loading) |
||||
} |
||||
|
||||
export default { |
||||
getChatLog, |
||||
delChatLog, |
||||
getChatRecordLog, |
||||
putChatRecordLog, |
||||
getMarkRecord, |
||||
getRecordDetail, |
||||
delMarkRecord, |
||||
exportChatLog, |
||||
getChatLogClient, |
||||
delChatClientLog, |
||||
postChatRecordLog |
||||
} |
@ -0,0 +1,209 @@
|
||||
import { request } from './../request/index' |
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import { type Ref } from 'vue' |
||||
import type { |
||||
modelRequest, |
||||
Provider, |
||||
ListModelRequest, |
||||
Model, |
||||
BaseModel, |
||||
CreateModelRequest, |
||||
EditModelRequest |
||||
} from '@/api/type/model' |
||||
import type { FormField } from '@/components/dynamics-form/type' |
||||
import type { KeyValue } from './type/common' |
||||
const prefix = '/model' |
||||
const prefix_provider = '/provider' |
||||
|
||||
/** |
||||
* 获得模型列表 |
||||
* @params 参数 name, model_type, model_name |
||||
*/ |
||||
const getModel: ( |
||||
request?: ListModelRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<Model>>> = (data, loading) => { |
||||
return get(`${prefix}`, data, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得供应商列表 |
||||
*/ |
||||
const getProvider: (loading?: Ref<boolean>) => Promise<Result<Array<Provider>>> = (loading) => { |
||||
return get(`${prefix_provider}`, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获得供应商列表 |
||||
*/ |
||||
const getProviderByModelType: (model_type: string, loading?: Ref<boolean>) => Promise<Result<Array<Provider>>> = (model_type, loading) => { |
||||
return get(`${prefix_provider}`, {model_type}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取模型创建表单 |
||||
* @param provider |
||||
* @param model_type |
||||
* @param model_name |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const getModelCreateForm: ( |
||||
provider: string, |
||||
model_type: string, |
||||
model_name: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<FormField>>> = (provider, model_type, model_name, loading) => { |
||||
return get(`${prefix_provider}/model_form`, { provider, model_type, model_name }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取模型参数表单 |
||||
* @param model_id 模型id |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const getModelParamsForm: ( |
||||
model_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<FormField>>> = (model_id, loading) => { |
||||
return get(`model/${model_id}/model_params_form`, {}, loading) |
||||
} |
||||
/** |
||||
* 获取模型类型列表 |
||||
* @param provider 供应商 |
||||
* @param loading 加载器 |
||||
* @returns 模型类型列表 |
||||
*/ |
||||
const listModelType: ( |
||||
provider: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<KeyValue<string, string>>>> = (provider, loading?: Ref<boolean>) => { |
||||
return get(`${prefix_provider}/model_type_list`, { provider }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取基础模型列表 |
||||
* @param provider |
||||
* @param model_type |
||||
* @param loading |
||||
* @returns |
||||
*/ |
||||
const listBaseModel: ( |
||||
provider: string, |
||||
model_type: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<BaseModel>>> = (provider, model_type, loading) => { |
||||
return get(`${prefix_provider}/model_list`, { provider, model_type }, loading) |
||||
} |
||||
|
||||
const listBaseModelParamsForm: ( |
||||
provider: string, |
||||
model_type: string, |
||||
model_name: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<BaseModel>>> = (provider, model_type, model_name, loading) => { |
||||
return get(`${prefix_provider}/model_params_form`, { provider, model_type, model_name}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建模型 |
||||
* @param request 请求对象 |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const createModel: ( |
||||
request: CreateModelRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Model>> = (request, loading) => { |
||||
return post(`${prefix}`, request, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改模型 |
||||
* @param request 請求對象 |
||||
* @param loading 加載器 |
||||
* @returns |
||||
*/ |
||||
const updateModel: ( |
||||
model_id: string, |
||||
request: EditModelRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Model>> = (model_id, request, loading) => { |
||||
return put(`${prefix}/${model_id}`, request, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改模型参数配置 |
||||
* @param request 請求對象 |
||||
* @param loading 加載器 |
||||
* @returns |
||||
*/ |
||||
const updateModelParamsForm: ( |
||||
model_id: string, |
||||
request: any[], |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Model>> = (model_id, request, loading) => { |
||||
return put(`${prefix}/${model_id}/model_params_form`, request, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取模型详情根据模型id 包括认证信息 |
||||
* @param model_id 模型id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const getModelById: (model_id: string, loading?: Ref<boolean>) => Promise<Result<Model>> = ( |
||||
model_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${model_id}`, {}, loading) |
||||
} |
||||
/** |
||||
* 获取模型信息不包括认证信息根据模型id |
||||
* @param model_id 模型id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const getModelMetaById: (model_id: string, loading?: Ref<boolean>) => Promise<Result<Model>> = ( |
||||
model_id, |
||||
loading |
||||
) => { |
||||
return get(`${prefix}/${model_id}/meta`, {}, loading) |
||||
} |
||||
/** |
||||
* 暂停下载 |
||||
* @param model_id 模型id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const pauseDownload: (model_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
model_id, |
||||
loading |
||||
) => { |
||||
return put(`${prefix}/${model_id}/pause_download`, undefined, {}, loading) |
||||
} |
||||
const deleteModel: (model_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
model_id, |
||||
loading |
||||
) => { |
||||
return del(`${prefix}/${model_id}`, undefined, {}, loading) |
||||
} |
||||
export default { |
||||
getModel, |
||||
getProvider, |
||||
getModelCreateForm, |
||||
listModelType, |
||||
listBaseModel, |
||||
listBaseModelParamsForm, |
||||
createModel, |
||||
updateModel, |
||||
deleteModel, |
||||
getModelById, |
||||
getModelMetaById, |
||||
pauseDownload, |
||||
getModelParamsForm, |
||||
updateModelParamsForm, |
||||
getProviderByModelType |
||||
} |
@ -0,0 +1,256 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import type { Ref } from 'vue' |
||||
const prefix = '/dataset' |
||||
|
||||
/** |
||||
* 段落列表 |
||||
* @param 参数 dataset_id document_id |
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* param { |
||||
"title": "string", |
||||
"content": "string", |
||||
} |
||||
*/ |
||||
const getParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, page, param, loading) => { |
||||
return get( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${page.current_page}/${page.page_size}`, |
||||
param, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 删除段落 |
||||
* @param 参数 dataset_id, document_id, paragraph_id |
||||
*/ |
||||
const delParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, paragraph_id, loading) => { |
||||
return del( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`, |
||||
undefined, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 批量删除段落 |
||||
* @param 参数 dataset_id, document_id |
||||
*/ |
||||
const delMulParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => { |
||||
return del( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/_batch`, |
||||
undefined, |
||||
{ id_list: data }, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 创建段落 |
||||
* @param 参数
|
||||
* dataset_id, document_id |
||||
* { |
||||
"content": "string", |
||||
"title": "string", |
||||
"is_active": true, |
||||
"problem_list": [ |
||||
{ |
||||
"id": "string", |
||||
"content": "string" |
||||
} |
||||
] |
||||
} |
||||
*/ |
||||
const postParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/document/${document_id}/paragraph`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改段落 |
||||
* @param 参数
|
||||
* dataset_id, document_id, paragraph_id |
||||
* { |
||||
"content": "string", |
||||
"title": "string", |
||||
"is_active": true, |
||||
"problem_list": [ |
||||
{ |
||||
"id": "string", |
||||
"content": "string" |
||||
} |
||||
] |
||||
} |
||||
*/ |
||||
const putParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 批量迁移段落 |
||||
* @param 参数 dataset_id,target_dataset_id, |
||||
*/ |
||||
const putMigrateMulParagraph: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
target_dataset_id: string, |
||||
target_document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = ( |
||||
dataset_id, |
||||
document_id, |
||||
target_dataset_id, |
||||
target_document_id, |
||||
data, |
||||
loading |
||||
) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/migrate/dataset/${target_dataset_id}/document/${target_document_id}`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 问题列表 |
||||
* @param 参数 dataset_id,document_id,paragraph_id |
||||
*/ |
||||
const getProblem: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string |
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id: string) => { |
||||
return get(`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`) |
||||
} |
||||
|
||||
/** |
||||
* 创建问题 |
||||
* @param 参数
|
||||
* dataset_id, document_id, paragraph_id |
||||
* { |
||||
"id": "string", |
||||
content": "string" |
||||
} |
||||
*/ |
||||
const postProblem: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, data: any, loading) => { |
||||
return post( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem`, |
||||
data, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* |
||||
* @param dataset_id 数据集id |
||||
* @param document_id 文档id |
||||
* @param paragraph_id 段落id |
||||
* @param problem_id 问题id |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const associationProblem: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string, |
||||
problem_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, document_id, paragraph_id, problem_id, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}/association`, |
||||
{}, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
/** |
||||
* 解除关联问题 |
||||
* @param 参数 dataset_id, document_id, paragraph_id,problem_id |
||||
*/ |
||||
const disassociationProblem: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
paragraph_id: string, |
||||
problem_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, paragraph_id, problem_id, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/${paragraph_id}/problem/${problem_id}/un_association`, |
||||
{}, |
||||
{}, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
const batchGenerateRelated: ( |
||||
dataset_id: string, |
||||
document_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, document_id, data, loading) => { |
||||
return put( |
||||
`${prefix}/${dataset_id}/document/${document_id}/paragraph/batch_generate_related`, |
||||
data, |
||||
undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
|
||||
export default { |
||||
getParagraph, |
||||
delParagraph, |
||||
putParagraph, |
||||
postParagraph, |
||||
getProblem, |
||||
postProblem, |
||||
disassociationProblem, |
||||
associationProblem, |
||||
delMulParagraph, |
||||
putMigrateMulParagraph, |
||||
batchGenerateRelated |
||||
} |
@ -0,0 +1,28 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/platform' |
||||
const getPlatformInfo: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get(`${prefix}/source`, undefined, loading) |
||||
} |
||||
|
||||
const updateConfig: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/source`, data, undefined, loading) |
||||
} |
||||
|
||||
const validateConnection: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return put(`${prefix}/source`, data, undefined, loading) |
||||
} |
||||
export default { |
||||
getPlatformInfo, |
||||
updateConfig, |
||||
validateConnection |
||||
} |
@ -0,0 +1,124 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { Ref } from 'vue' |
||||
import type { KeyValue } from '@/api/type/common' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
const prefix = '/dataset' |
||||
|
||||
/** |
||||
* 文档分页列表 |
||||
* @param 参数 dataset_id,
|
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* query { |
||||
"content": "string", |
||||
} |
||||
*/ |
||||
|
||||
const getProblems: ( |
||||
dataset_id: string, |
||||
page: pageRequest, |
||||
param: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, page, param, loading) => { |
||||
return get( |
||||
`${prefix}/${dataset_id}/problem/${page.current_page}/${page.page_size}`, |
||||
param, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 创建问题 |
||||
* @param 参数 dataset_id |
||||
* data: array[string] |
||||
*/ |
||||
const postProblems: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/problem`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除问题 |
||||
* @param 参数 dataset_id, problem_id, |
||||
*/ |
||||
const delProblems: ( |
||||
dataset_id: string, |
||||
problem_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, problem_id, loading) => { |
||||
return del(`${prefix}/${dataset_id}/problem/${problem_id}`, loading) |
||||
} |
||||
|
||||
/** |
||||
* 批量删除问题 |
||||
* @param 参数 dataset_id, |
||||
*/ |
||||
const delMulProblem: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return del(`${prefix}/${dataset_id}/problem/_batch`, undefined, data, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改问题 |
||||
* @param 参数
|
||||
* dataset_id, problem_id,
|
||||
* { |
||||
"content": "string", |
||||
} |
||||
*/ |
||||
const putProblems: ( |
||||
dataset_id: string, |
||||
problem_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, problem_id, data: any, loading) => { |
||||
return put(`${prefix}/${dataset_id}/problem/${problem_id}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 问题详情 |
||||
* @param 参数 |
||||
* dataset_id, problem_id, |
||||
*/ |
||||
const getDetailProblems: ( |
||||
dataset_id: string, |
||||
problem_id: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (dataset_id, problem_id, loading) => { |
||||
return get(`${prefix}/${dataset_id}/problem/${problem_id}/paragraph`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 批量关联段落 |
||||
* @param 参数 dataset_id, |
||||
* { |
||||
"problem_id_list": "Array", |
||||
"paragraph_list": "Array", |
||||
} |
||||
*/ |
||||
const postMulAssociationProblem: ( |
||||
dataset_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (dataset_id, data, loading) => { |
||||
return post(`${prefix}/${dataset_id}/problem/_batch`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getProblems, |
||||
postProblems, |
||||
delProblems, |
||||
putProblems, |
||||
getDetailProblems, |
||||
delMulProblem, |
||||
postMulAssociationProblem |
||||
} |
@ -0,0 +1,12 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post } from '@/request/index' |
||||
import type { Ref } from 'vue' |
||||
const trigger: ( |
||||
provider: string, |
||||
method: string, |
||||
request_body: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<Array<any> | string>> = (provider, method, request_body, loading) => { |
||||
return post(`provider/${provider}/${method}`, {}, request_body, loading) |
||||
} |
||||
export default { trigger, get } |
@ -0,0 +1,58 @@
|
||||
import {Result} from '@/request/Result' |
||||
import {get, post, del, put} from '@/request/index' |
||||
|
||||
import {type Ref} from 'vue' |
||||
|
||||
const prefix = '/system/api_key' |
||||
|
||||
/** |
||||
* API_KEY列表 |
||||
*/ |
||||
const getAPIKey: (loading?: Ref<boolean>) => Promise<Result<any>> = () => { |
||||
return get(`${prefix}/`) |
||||
} |
||||
|
||||
/** |
||||
* 新增API_KEY |
||||
*/ |
||||
const postAPIKey: (loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/`, {}, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 删除API_KEY |
||||
* @param 参数 application_id api_key_id |
||||
*/ |
||||
const delAPIKey: ( |
||||
api_key_id: String, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (api_key_id, loading) => { |
||||
return del(`${prefix}/${api_key_id}/`, undefined, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 修改API_KEY |
||||
* data { |
||||
* is_active: boolean |
||||
* } |
||||
* @param api_key_id |
||||
* @param data |
||||
* @param loading |
||||
*/ |
||||
const putAPIKey: ( |
||||
api_key_id: String, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (api_key_id, data, loading) => { |
||||
return put(`${prefix}/${api_key_id}/`, data, undefined, loading) |
||||
} |
||||
|
||||
|
||||
export default { |
||||
getAPIKey, |
||||
postAPIKey, |
||||
delAPIKey, |
||||
putAPIKey |
||||
} |
@ -0,0 +1,67 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { TeamMember } from '@/api/type/team' |
||||
|
||||
const prefix = '/team/member' |
||||
|
||||
/** |
||||
* 获取团队成员列表 |
||||
*/ |
||||
const getTeamMember: () => Promise<Result<TeamMember[]>> = () => { |
||||
return get(`${prefix}`) |
||||
} |
||||
|
||||
/** |
||||
* 添加成员 |
||||
* @param 参数 [] |
||||
*/ |
||||
const postCreatTeamMember: (data: Array<String>) => Promise<Result<boolean>> = (data) => { |
||||
return post(`${prefix}/_batch`, data) |
||||
} |
||||
|
||||
/** |
||||
* 删除成员 |
||||
* @param 参数 member_id |
||||
*/ |
||||
const delTeamMember: (member_id: String) => Promise<Result<boolean>> = (member_id) => { |
||||
return del(`${prefix}/${member_id}`) |
||||
} |
||||
|
||||
/** |
||||
* 获取成员权限 |
||||
* @param 参数 member_id |
||||
*/ |
||||
const getMemberPermissions: (member_id: String) => Promise<Result<any>> = (member_id) => { |
||||
return get(`${prefix}/${member_id}`) |
||||
} |
||||
|
||||
/** |
||||
* 获取成员权限 |
||||
* @param 参数 member_id |
||||
* @param 参数 { |
||||
"team_member_permission_list": [ |
||||
{ |
||||
"target_id": "string", |
||||
"type": "string", |
||||
"operate": { |
||||
"USE": true, |
||||
"MANAGE": true |
||||
} |
||||
} |
||||
] |
||||
} |
||||
*/ |
||||
const putMemberPermissions: (member_id: String, body: any) => Promise<Result<any>> = ( |
||||
member_id, |
||||
body |
||||
) => { |
||||
return put(`${prefix}/${member_id}`, body) |
||||
} |
||||
|
||||
export default { |
||||
getTeamMember, |
||||
postCreatTeamMember, |
||||
delTeamMember, |
||||
getMemberPermissions, |
||||
putMemberPermissions |
||||
} |
@ -0,0 +1,35 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { Ref } from 'vue' |
||||
const prefix = '/display' |
||||
|
||||
/** |
||||
* 查看外观设置 |
||||
*/ |
||||
const getThemeInfo: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get(`${prefix}/info`, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 更新外观设置 |
||||
* @param 参数 |
||||
* * formData { |
||||
* theme |
||||
* icon |
||||
* loginLogo |
||||
* loginImage |
||||
* title |
||||
* slogan |
||||
* } |
||||
*/ |
||||
const postThemeInfo: (data: any, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}/update`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getThemeInfo, |
||||
postThemeInfo |
||||
} |
@ -0,0 +1,420 @@
|
||||
import { type Dict } from '@/api/type/common' |
||||
import { type Ref } from 'vue' |
||||
interface ApplicationFormType { |
||||
name?: string |
||||
desc?: string |
||||
model_id?: string |
||||
dialogue_number?: number |
||||
prologue?: string |
||||
dataset_id_list?: string[] |
||||
dataset_setting?: any |
||||
model_setting?: any |
||||
problem_optimization?: boolean |
||||
problem_optimization_prompt?: string |
||||
icon?: string | undefined |
||||
type?: string |
||||
work_flow?: any |
||||
model_params_setting?: any |
||||
tts_model_params_setting?: any |
||||
stt_model_id?: string |
||||
tts_model_id?: string |
||||
stt_model_enable?: boolean |
||||
tts_model_enable?: boolean |
||||
tts_type?: string |
||||
} |
||||
interface Chunk { |
||||
real_node_id: string |
||||
chat_id: string |
||||
chat_record_id: string |
||||
content: string |
||||
node_id: string |
||||
up_node_id: string |
||||
is_end: boolean |
||||
node_is_end: boolean |
||||
node_type: string |
||||
view_type: string |
||||
runtime_node_id: string |
||||
child_node: any |
||||
} |
||||
interface chatType { |
||||
id: string |
||||
problem_text: string |
||||
answer_text: string |
||||
buffer: Array<String> |
||||
answer_text_list: Array<{ |
||||
content: string |
||||
chat_record_id?: string |
||||
runtime_node_id?: string |
||||
child_node?: any |
||||
}> |
||||
/** |
||||
* 是否写入结束 |
||||
*/ |
||||
write_ed?: boolean |
||||
/** |
||||
* 是否暂停 |
||||
*/ |
||||
is_stop?: boolean |
||||
record_id: string |
||||
chat_id: string |
||||
vote_status: string |
||||
status?: number |
||||
execution_details: any[] |
||||
upload_meta?: { |
||||
document_list: Array<any> |
||||
image_list: Array<any> |
||||
audio_list: Array<any> |
||||
} |
||||
} |
||||
|
||||
interface Node { |
||||
buffer: Array<string> |
||||
node_id: string |
||||
up_node_id: string |
||||
node_type: string |
||||
view_type: string |
||||
index: number |
||||
is_end: boolean |
||||
} |
||||
interface WriteNodeInfo { |
||||
current_node: any |
||||
answer_text_list_index: number |
||||
current_up_node?: any |
||||
divider_content?: Array<string> |
||||
} |
||||
export class ChatRecordManage { |
||||
id?: any |
||||
ms: number |
||||
chat: chatType |
||||
is_close?: boolean |
||||
write_ed?: boolean |
||||
is_stop?: boolean |
||||
loading?: Ref<boolean> |
||||
node_list: Array<any> |
||||
write_node_info?: WriteNodeInfo |
||||
constructor(chat: chatType, ms?: number, loading?: Ref<boolean>) { |
||||
this.ms = ms ? ms : 10 |
||||
this.chat = chat |
||||
this.loading = loading |
||||
this.is_stop = false |
||||
this.is_close = false |
||||
this.write_ed = false |
||||
this.node_list = [] |
||||
} |
||||
append_answer( |
||||
chunk_answer: string, |
||||
index?: number, |
||||
chat_record_id?: string, |
||||
runtime_node_id?: string, |
||||
child_node?: any |
||||
) { |
||||
const set_index = index != undefined ? index : this.chat.answer_text_list.length - 1 |
||||
const content = this.chat.answer_text_list[set_index] |
||||
? this.chat.answer_text_list[set_index].content + chunk_answer |
||||
: chunk_answer |
||||
this.chat.answer_text_list[set_index] = { |
||||
content: content, |
||||
chat_record_id, |
||||
runtime_node_id, |
||||
child_node |
||||
} |
||||
|
||||
this.chat.answer_text = this.chat.answer_text + chunk_answer |
||||
} |
||||
get_current_up_node(run_node: any) { |
||||
const index = this.node_list.findIndex((item) => item == run_node) |
||||
if (index > 0) { |
||||
const n = this.node_list[index - 1] |
||||
return n |
||||
} |
||||
return undefined |
||||
} |
||||
get_run_node() { |
||||
if ( |
||||
this.write_node_info && |
||||
(this.write_node_info.current_node.buffer.length > 0 || |
||||
!this.write_node_info.current_node.is_end) |
||||
) { |
||||
return this.write_node_info |
||||
} |
||||
const run_node = this.node_list.filter((item) => item.buffer.length > 0 || !item.is_end)[0] |
||||
|
||||
if (run_node) { |
||||
const index = this.node_list.indexOf(run_node) |
||||
let current_up_node = undefined |
||||
if (index > 0) { |
||||
current_up_node = this.get_current_up_node(run_node) |
||||
} |
||||
let answer_text_list_index = 0 |
||||
if ( |
||||
current_up_node == undefined || |
||||
run_node.view_type == 'single_view' || |
||||
current_up_node.view_type == 'single_view' |
||||
) { |
||||
const none_index = this.findIndex( |
||||
this.chat.answer_text_list, |
||||
(item) => item.content == '', |
||||
'index' |
||||
) |
||||
if (none_index > -1) { |
||||
answer_text_list_index = none_index |
||||
} else { |
||||
answer_text_list_index = this.chat.answer_text_list.length |
||||
} |
||||
} else { |
||||
const none_index = this.findIndex( |
||||
this.chat.answer_text_list, |
||||
(item) => item.content === '', |
||||
'index' |
||||
) |
||||
if (none_index > -1) { |
||||
answer_text_list_index = none_index |
||||
} else { |
||||
answer_text_list_index = this.chat.answer_text_list.length - 1 |
||||
} |
||||
} |
||||
|
||||
this.write_node_info = { |
||||
current_node: run_node, |
||||
divider_content: ['\n\n'], |
||||
current_up_node: current_up_node, |
||||
answer_text_list_index: answer_text_list_index |
||||
} |
||||
return this.write_node_info |
||||
} |
||||
return undefined |
||||
} |
||||
findIndex<T>(array: Array<T>, find: (item: T) => boolean, type: 'last' | 'index') { |
||||
let set_index = -1 |
||||
for (let index = 0; index < array.length; index++) { |
||||
const element = array[index] |
||||
if (find(element)) { |
||||
set_index = index |
||||
if (type == 'index') { |
||||
break |
||||
} |
||||
} |
||||
} |
||||
return set_index |
||||
} |
||||
closeInterval() { |
||||
this.chat.write_ed = true |
||||
this.write_ed = true |
||||
if (this.loading) { |
||||
this.loading.value = false |
||||
} |
||||
if (this.id) { |
||||
clearInterval(this.id) |
||||
} |
||||
const last_index = this.findIndex( |
||||
this.chat.answer_text_list, |
||||
(item) => item.content == '', |
||||
'last' |
||||
) |
||||
if (last_index > 0) { |
||||
this.chat.answer_text_list.splice(last_index, 1) |
||||
} |
||||
} |
||||
write() { |
||||
this.chat.is_stop = false |
||||
this.is_stop = false |
||||
this.is_close = false |
||||
this.write_ed = false |
||||
this.chat.write_ed = false |
||||
if (this.loading) { |
||||
this.loading.value = true |
||||
} |
||||
this.id = setInterval(() => { |
||||
const node_info = this.get_run_node() |
||||
if (node_info == undefined) { |
||||
if (this.is_close) { |
||||
this.closeInterval() |
||||
} |
||||
return |
||||
} |
||||
const { current_node, answer_text_list_index, divider_content } = node_info |
||||
if (current_node.buffer.length > 20) { |
||||
const context = current_node.is_end |
||||
? current_node.buffer.splice(0) |
||||
: current_node.buffer.splice( |
||||
0, |
||||
current_node.is_end ? undefined : current_node.buffer.length - 20 |
||||
) |
||||
this.append_answer( |
||||
(divider_content ? divider_content.splice(0).join('') : '') + context.join(''), |
||||
answer_text_list_index, |
||||
current_node.chat_record_id, |
||||
current_node.runtime_node_id, |
||||
current_node.child_node |
||||
) |
||||
} else if (this.is_close) { |
||||
while (true) { |
||||
const node_info = this.get_run_node() |
||||
|
||||
if (node_info == undefined) { |
||||
break |
||||
} |
||||
this.append_answer( |
||||
(node_info.divider_content ? node_info.divider_content.splice(0).join('') : '') + |
||||
node_info.current_node.buffer.splice(0).join(''), |
||||
node_info.answer_text_list_index, |
||||
node_info.current_node.chat_record_id, |
||||
node_info.current_node.runtime_node_id, |
||||
node_info.current_node.child_node |
||||
) |
||||
if (node_info.current_node.buffer.length == 0) { |
||||
node_info.current_node.is_end = true |
||||
} |
||||
} |
||||
this.closeInterval() |
||||
} else { |
||||
const s = current_node.buffer.shift() |
||||
if (s !== undefined) { |
||||
this.append_answer( |
||||
(divider_content ? divider_content.splice(0).join('') : '') + s, |
||||
answer_text_list_index, |
||||
current_node.chat_record_id, |
||||
current_node.runtime_node_id, |
||||
current_node.child_node |
||||
) |
||||
} |
||||
} |
||||
}, this.ms) |
||||
} |
||||
stop() { |
||||
clearInterval(this.id) |
||||
this.is_stop = true |
||||
this.chat.is_stop = true |
||||
if (this.loading) { |
||||
this.loading.value = false |
||||
} |
||||
} |
||||
close() { |
||||
this.is_close = true |
||||
} |
||||
open() { |
||||
this.is_close = false |
||||
this.is_stop = false |
||||
} |
||||
appendChunk(chunk: Chunk) { |
||||
let n = this.node_list.find((item) => item.real_node_id == chunk.real_node_id) |
||||
if (n) { |
||||
n.buffer.push(...chunk.content) |
||||
n.content += chunk.content |
||||
} else { |
||||
n = { |
||||
buffer: [...chunk.content], |
||||
content: chunk.content, |
||||
real_node_id: chunk.real_node_id, |
||||
node_id: chunk.node_id, |
||||
chat_record_id: chunk.chat_record_id, |
||||
up_node_id: chunk.up_node_id, |
||||
runtime_node_id: chunk.runtime_node_id, |
||||
child_node: chunk.child_node, |
||||
node_type: chunk.node_type, |
||||
index: this.node_list.length, |
||||
view_type: chunk.view_type, |
||||
is_end: false |
||||
} |
||||
this.node_list.push(n) |
||||
} |
||||
if (chunk.node_is_end) { |
||||
n['is_end'] = true |
||||
} |
||||
} |
||||
append(answer_text_block: string) { |
||||
let set_index = this.findIndex( |
||||
this.chat.answer_text_list, |
||||
(item) => item.content == '', |
||||
'index' |
||||
) |
||||
this.chat.answer_text_list[set_index] = { content: answer_text_block } |
||||
} |
||||
} |
||||
|
||||
export class ChatManagement { |
||||
static chatMessageContainer: Dict<ChatRecordManage> = {} |
||||
|
||||
static addChatRecord(chat: chatType, ms: number, loading?: Ref<boolean>) { |
||||
this.chatMessageContainer[chat.id] = new ChatRecordManage(chat, ms, loading) |
||||
} |
||||
static appendChunk(chatRecordId: string, chunk: Chunk) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.appendChunk(chunk) |
||||
} |
||||
} |
||||
static append(chatRecordId: string, content: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.append(content) |
||||
} |
||||
} |
||||
static updateStatus(chatRecordId: string, code: number) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.chat.status = code |
||||
} |
||||
} |
||||
/** |
||||
* 持续从缓存区 写出数据 |
||||
* @param chatRecordId 对话记录id |
||||
*/ |
||||
static write(chatRecordId: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.write() |
||||
} |
||||
} |
||||
/** |
||||
* 等待所有数据输出完毕后 才会关闭流 |
||||
* @param chatRecordId 对话记录id |
||||
* @returns boolean |
||||
*/ |
||||
static close(chatRecordId: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.close() |
||||
} |
||||
} |
||||
/** |
||||
* 停止输出 立即关闭定时任务输出 |
||||
* @param chatRecordId 对话记录id |
||||
* @returns boolean |
||||
*/ |
||||
static stop(chatRecordId: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
if (chatRecord) { |
||||
chatRecord.stop() |
||||
} |
||||
} |
||||
/** |
||||
* 判断是否输出完成 |
||||
* @param chatRecordId 对话记录id |
||||
* @returns boolean |
||||
*/ |
||||
static isClose(chatRecordId: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
return chatRecord ? chatRecord.is_close && chatRecord.write_ed : false |
||||
} |
||||
/** |
||||
* 判断是否停止输出 |
||||
* @param chatRecordId 对话记录id |
||||
* @returns |
||||
*/ |
||||
static isStop(chatRecordId: string) { |
||||
const chatRecord = this.chatMessageContainer[chatRecordId] |
||||
return chatRecord ? chatRecord.is_stop : false |
||||
} |
||||
/** |
||||
* 清除无用数据 也就是被close掉的和stop的数据 |
||||
*/ |
||||
static clean() { |
||||
for (const key in Object.keys(this.chatMessageContainer)) { |
||||
if (this.chatMessageContainer[key].is_close) { |
||||
delete this.chatMessageContainer[key] |
||||
} |
||||
} |
||||
} |
||||
} |
||||
export type { ApplicationFormType, chatType } |
@ -0,0 +1,14 @@
|
||||
interface KeyValue<K, V> { |
||||
key: K |
||||
value: V |
||||
} |
||||
interface Dict<V> { |
||||
[propName: string]: V |
||||
} |
||||
|
||||
interface pageRequest { |
||||
current_page: number |
||||
page_size: number |
||||
} |
||||
|
||||
export type { KeyValue, Dict, pageRequest } |
@ -0,0 +1,9 @@
|
||||
interface datasetData { |
||||
name: String |
||||
desc: String |
||||
documents?: Array<any> |
||||
type?: String |
||||
embedding_mode_id?: String |
||||
} |
||||
|
||||
export type { datasetData } |
@ -0,0 +1,11 @@
|
||||
interface functionLibData { |
||||
id?: String |
||||
name?: String |
||||
desc?: String |
||||
code?: String |
||||
permission_type?: 'PRIVATE' | 'PUBLIC' |
||||
input_field_list?: Array<any> |
||||
is_active?: Boolean |
||||
} |
||||
|
||||
export type { functionLibData } |
@ -0,0 +1,148 @@
|
||||
import { store } from '@/stores' |
||||
import type { Dict } from './common' |
||||
interface modelRequest { |
||||
name: string |
||||
model_type: string |
||||
model_name: string |
||||
} |
||||
|
||||
interface Provider { |
||||
/** |
||||
* 供应商代号 |
||||
*/ |
||||
provider: string |
||||
/** |
||||
* 供应商名称 |
||||
*/ |
||||
name: string |
||||
/** |
||||
* 供应商icon |
||||
*/ |
||||
icon: string |
||||
} |
||||
|
||||
interface ListModelRequest { |
||||
/** |
||||
* 模型名称 |
||||
*/ |
||||
name?: string |
||||
/** |
||||
* 模型类型 |
||||
*/ |
||||
model_type?: string |
||||
/** |
||||
* 基础模型名称 |
||||
*/ |
||||
model_name?: string |
||||
/** |
||||
* 供应商 |
||||
*/ |
||||
provider?: string |
||||
} |
||||
|
||||
interface Model { |
||||
/** |
||||
* 主键id |
||||
*/ |
||||
id: string |
||||
/** |
||||
* 模型名 |
||||
*/ |
||||
name: string |
||||
/** |
||||
* 模型类型 |
||||
*/ |
||||
model_type: string |
||||
user_id: string |
||||
username: string |
||||
permission_type: 'PUBLIC' | 'PRIVATE' |
||||
/** |
||||
* 基础模型 |
||||
*/ |
||||
model_name: string |
||||
/** |
||||
* 认证信息 |
||||
*/ |
||||
credential: any |
||||
/** |
||||
* 供应商 |
||||
*/ |
||||
provider: string |
||||
/** |
||||
* 状态 |
||||
*/ |
||||
status: 'SUCCESS' | 'DOWNLOAD' | 'ERROR' | 'PAUSE_DOWNLOAD' |
||||
/** |
||||
* 元数据 |
||||
*/ |
||||
meta: Dict<any> |
||||
/** |
||||
* 模型参数配置 |
||||
*/ |
||||
model_params_form: Dict<any>[] |
||||
} |
||||
interface CreateModelRequest { |
||||
/** |
||||
* 模型名 |
||||
*/ |
||||
name: string |
||||
/** |
||||
* 模型类型 |
||||
*/ |
||||
model_type: string |
||||
/** |
||||
* 基础模型 |
||||
*/ |
||||
model_name: string |
||||
/** |
||||
* 认证信息 |
||||
*/ |
||||
credential: any |
||||
/** |
||||
* 供应商 |
||||
*/ |
||||
provider: string |
||||
} |
||||
|
||||
interface EditModelRequest { |
||||
/** |
||||
* 模型名 |
||||
*/ |
||||
name: string |
||||
/** |
||||
* 模型类型 |
||||
*/ |
||||
model_type: string |
||||
/** |
||||
* 基础模型 |
||||
*/ |
||||
model_name: string |
||||
/** |
||||
* 认证信息 |
||||
*/ |
||||
credential: any |
||||
} |
||||
|
||||
interface BaseModel { |
||||
/** |
||||
* 基础模型名称 |
||||
*/ |
||||
name: string |
||||
/** |
||||
* 基础模型描述 |
||||
*/ |
||||
desc: string |
||||
/** |
||||
* 基础模型类型 |
||||
*/ |
||||
model_type: string |
||||
} |
||||
export type { |
||||
modelRequest, |
||||
Provider, |
||||
ListModelRequest, |
||||
Model, |
||||
BaseModel, |
||||
CreateModelRequest, |
||||
EditModelRequest |
||||
} |
@ -0,0 +1,13 @@
|
||||
interface TeamMember { |
||||
id: string |
||||
username: string |
||||
email: string |
||||
team_id: string |
||||
/** |
||||
* 类型:type:manage 所有者; |
||||
*/ |
||||
type: string |
||||
user_id: string |
||||
} |
||||
|
||||
export type { TeamMember } |
@ -0,0 +1,120 @@
|
||||
interface User { |
||||
/** |
||||
* 用户id |
||||
*/ |
||||
id: string |
||||
/** |
||||
* 用户名 |
||||
*/ |
||||
username: string |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
email: string |
||||
/** |
||||
* 用户角色 |
||||
*/ |
||||
role: string |
||||
/** |
||||
* 用户权限 |
||||
*/ |
||||
permissions: Array<string> |
||||
/** |
||||
* 是否需要修改密码 |
||||
*/ |
||||
is_edit_password?: boolean |
||||
IS_XPACK?: boolean |
||||
XPACK_LICENSE_IS_VALID?: boolean |
||||
} |
||||
|
||||
interface LoginRequest { |
||||
/** |
||||
* 用户名 |
||||
*/ |
||||
username: string |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
password: string |
||||
} |
||||
|
||||
interface RegisterRequest { |
||||
/** |
||||
* 用户名 |
||||
*/ |
||||
username: string |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
password: string |
||||
/** |
||||
* 确定密码 |
||||
*/ |
||||
re_password: string |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
email: string |
||||
/** |
||||
* 验证码 |
||||
*/ |
||||
code: string |
||||
} |
||||
|
||||
interface CheckCodeRequest { |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
email: string |
||||
/** |
||||
*验证码 |
||||
*/ |
||||
code: string |
||||
/** |
||||
* 类型 |
||||
*/ |
||||
type: 'register' | 'reset_password' |
||||
} |
||||
|
||||
interface ResetCurrentUserPasswordRequest { |
||||
/** |
||||
* 验证码 |
||||
*/ |
||||
code: string |
||||
/** |
||||
*密码 |
||||
*/ |
||||
password: string |
||||
/** |
||||
* 确认密码 |
||||
*/ |
||||
re_password: string |
||||
} |
||||
|
||||
interface ResetPasswordRequest { |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
email?: string |
||||
/** |
||||
* 验证码 |
||||
*/ |
||||
code?: string |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
password: string |
||||
/** |
||||
* 确认密码 |
||||
*/ |
||||
re_password: string |
||||
} |
||||
|
||||
export type { |
||||
LoginRequest, |
||||
RegisterRequest, |
||||
CheckCodeRequest, |
||||
ResetPasswordRequest, |
||||
User, |
||||
ResetCurrentUserPasswordRequest |
||||
} |
@ -0,0 +1,77 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post, del, put } from '@/request/index' |
||||
import type { pageRequest } from '@/api/type/common' |
||||
import { type Ref } from 'vue' |
||||
|
||||
const prefix = '/user_manage' |
||||
/** |
||||
* 用户分页列表 |
||||
* @param 参数
|
||||
* page { |
||||
"current_page": "string", |
||||
"page_size": "string", |
||||
} |
||||
* @query 参数
|
||||
email_or_username: string |
||||
*/ |
||||
const getUserManage: ( |
||||
page: pageRequest, |
||||
email_or_username: string, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (page, email_or_username, loading) => { |
||||
return get( |
||||
`${prefix}/${page.current_page}/${page.page_size}`, |
||||
email_or_username ? { email_or_username } : undefined, |
||||
loading |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* 删除用户 |
||||
* @param 参数 user_id, |
||||
*/ |
||||
const delUserManage: (user_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
user_id, |
||||
loading |
||||
) => { |
||||
return del(`${prefix}/${user_id}`, undefined, {}, loading) |
||||
} |
||||
|
||||
/** |
||||
* 创建用户 |
||||
*/ |
||||
const postUserManage: (data: any, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
data, |
||||
loading |
||||
) => { |
||||
return post(`${prefix}`, data, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 编辑用户 |
||||
*/ |
||||
const putUserManage: ( |
||||
user_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (user_id, data, loading) => { |
||||
return put(`${prefix}/${user_id}`, data, undefined, loading) |
||||
} |
||||
/** |
||||
* 修改用户密码 |
||||
*/ |
||||
const putUserManagePassword: ( |
||||
user_id: string, |
||||
data: any, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (user_id, data, loading) => { |
||||
return put(`${prefix}/${user_id}/re_password`, data, undefined, loading) |
||||
} |
||||
|
||||
export default { |
||||
getUserManage, |
||||
delUserManage, |
||||
postUserManage, |
||||
putUserManage, |
||||
putUserManagePassword |
||||
} |
@ -0,0 +1,196 @@
|
||||
import { Result } from '@/request/Result' |
||||
import { get, post } from '@/request/index' |
||||
import type { |
||||
LoginRequest, |
||||
RegisterRequest, |
||||
CheckCodeRequest, |
||||
ResetPasswordRequest, |
||||
User, |
||||
ResetCurrentUserPasswordRequest |
||||
} from '@/api/type/user' |
||||
import type { Ref } from 'vue' |
||||
|
||||
/** |
||||
* 登录 |
||||
* @param auth_type |
||||
* @param request 登录接口请求表单 |
||||
* @param loading 接口加载器 |
||||
* @returns 认证数据 |
||||
*/ |
||||
const login: ( |
||||
auth_type: string, |
||||
request: LoginRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<string>> = (auth_type, request, loading) => { |
||||
if (auth_type !== '') { |
||||
return post(`/${auth_type}/login`, request, undefined, loading) |
||||
} |
||||
return post('/user/login', request, undefined, loading) |
||||
} |
||||
/** |
||||
* 登出 |
||||
* @param loading 接口加载器 |
||||
* @returns |
||||
*/ |
||||
const logout: (loading?: Ref<boolean>) => Promise<Result<boolean>> = (loading) => { |
||||
return post('/user/logout', undefined, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 注册用户 |
||||
* @param request 注册请求对象 |
||||
* @param loading 接口加载器 |
||||
* @returns |
||||
*/ |
||||
const register: (request: RegisterRequest, loading?: Ref<boolean>) => Promise<Result<string>> = ( |
||||
request, |
||||
loading |
||||
) => { |
||||
return post('/user/register', request, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 校验验证码 |
||||
* @param request 请求对象 |
||||
* @param loading 接口加载器 |
||||
* @returns |
||||
*/ |
||||
const checkCode: (request: CheckCodeRequest, loading?: Ref<boolean>) => Promise<Result<boolean>> = ( |
||||
request, |
||||
loading |
||||
) => { |
||||
return post('/user/check_code', request, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 发送邮件 |
||||
* @param email 邮件地址 |
||||
* @param loading 接口加载器 |
||||
* @returns |
||||
*/ |
||||
const sendEmit: ( |
||||
email: string, |
||||
type: 'register' | 'reset_password', |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (email, type, loading) => { |
||||
return post('/user/send_email', { email, type }, undefined, loading) |
||||
} |
||||
/** |
||||
* 发送邮件到当前用户 |
||||
* @param loading 发送验证码到当前用户 |
||||
* @returns |
||||
*/ |
||||
const sendEmailToCurrent: (loading?: Ref<boolean>) => Promise<Result<boolean>> = (loading) => { |
||||
return post('/user/current/send_email', undefined, undefined, loading) |
||||
} |
||||
/** |
||||
* 修改当前用户密码 |
||||
* @param request 请求对象 |
||||
* @param loading 加载器 |
||||
* @returns |
||||
*/ |
||||
const resetCurrentUserPassword: ( |
||||
request: ResetCurrentUserPasswordRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (request, loading) => { |
||||
return post('/user/current/reset_password', request, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取用户基本信息 |
||||
* @param loading 接口加载器 |
||||
* @returns 用户基本信息 |
||||
*/ |
||||
const profile: (loading?: Ref<boolean>) => Promise<Result<User>> = (loading) => { |
||||
return get('/user', undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 重置密码 |
||||
* @param request 重置密码请求参数 |
||||
* @param loading 接口加载器 |
||||
* @returns |
||||
*/ |
||||
const resetPassword: ( |
||||
request: ResetPasswordRequest, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<boolean>> = (request, loading) => { |
||||
return post('/user/re_password', request, undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 添加团队需要查询用户列表 |
||||
* @param loading 接口加载器 |
||||
* email_or_username |
||||
*/ |
||||
const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
email_or_username, |
||||
loading |
||||
) => { |
||||
return get('/user/list', { email_or_username }, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取profile |
||||
*/ |
||||
const getProfile: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get('/profile', undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取校验 |
||||
* @param valid_type 校验类型: application|dataset|user |
||||
* @param valid_count 校验数量: 5 | 50 | 2 |
||||
*/ |
||||
const getValid: ( |
||||
valid_type: string, |
||||
valid_count: number, |
||||
loading?: Ref<boolean> |
||||
) => Promise<Result<any>> = (valid_type, valid_count, loading) => { |
||||
return get(`/valid/${valid_type}/${valid_count}`, undefined, loading) |
||||
} |
||||
/** |
||||
* 获取登录方式 |
||||
*/ |
||||
const getAuthType: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get('auth/types', undefined, loading) |
||||
} |
||||
|
||||
/** |
||||
* 获取二维码类型 |
||||
*/ |
||||
const getQrType: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => { |
||||
return get('qr_type', undefined, loading) |
||||
} |
||||
|
||||
const getDingCallback: (code: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
code, |
||||
loading |
||||
) => { |
||||
return get('dingtalk', { code }, loading) |
||||
} |
||||
|
||||
const getWecomCallback: (code: string, loading?: Ref<boolean>) => Promise<Result<any>> = ( |
||||
code, |
||||
loading |
||||
) => { |
||||
return get('wecom', { code }, loading) |
||||
} |
||||
|
||||
export default { |
||||
login, |
||||
register, |
||||
sendEmit, |
||||
checkCode, |
||||
profile, |
||||
resetPassword, |
||||
sendEmailToCurrent, |
||||
resetCurrentUserPassword, |
||||
logout, |
||||
getUserList, |
||||
getProfile, |
||||
getValid, |
||||
getAuthType, |
||||
getDingCallback, |
||||
getQrType, |
||||
getWecomCallback |
||||
} |
After Width: | Height: | Size: 359 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 240 B |
After Width: | Height: | Size: 4.7 KiB |
@ -0,0 +1 @@
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function t(e,t){return n.call(e,t)}var i=[],a=function(e,n){var t={options:{timestamp:+new Date},name:e,arg:n};if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){if("postMessage"===e){var a={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(a):window.__dcloud_weex_.postMessage(JSON.stringify(a))}var o={type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(o):window.__dcloud_weex_.postMessageToService(JSON.stringify(o))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:t,pageId:""},"*");if(0===i.length){var r=plus.webview.currentWebview();if(!r)throw new Error("plus.webview.currentWebview() is undefined");var d=r.parent(),s="";s=d?d.id:r.id,i.push(s)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:t,webviewIds:i}},"__uniapp__service");else{var w=JSON.stringify(t);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(w,",").concat(JSON.stringify(i),");"))}},o={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;a("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;a("redirectTo",{url:encodeURI(n)})},getEnv:function(e){window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a("postMessage",e.data||{})}},r=/uni-app/i.test(navigator.userAgent),d=/Html5Plus/i.test(navigator.userAgent),s=/complete|loaded|interactive/;var w=window.my&&navigator.userAgent.indexOf("AlipayClient")>-1;var u=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var g=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var v=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);for(var l,_=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},f=[function(e){if(r||d)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&s.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),o},function(e){if(v)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(w){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(u)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){return document.addEventListener("DOMContentLoaded",e),o}],m=0;m<f.length&&!(l=f[m](_));m++);l||(l={});var E="undefined"!=typeof uni?uni:{};if(!E.navigateTo)for(var b in l)t(l,b)&&(E[b]=l[b]);return E.webView=l,E})); |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 770 KiB |
After Width: | Height: | Size: 647 KiB |
After Width: | Height: | Size: 674 KiB |
After Width: | Height: | Size: 602 KiB |
After Width: | Height: | Size: 626 KiB |
After Width: | Height: | Size: 220 KiB |