Compare commits
72 Commits
694577f2a6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0344ff2862 | |||
| 17bae862ed | |||
| fb64b1a768 | |||
| 05c1f339e6 | |||
| f822e319ba | |||
| 2962865857 | |||
| 5415da5b6c | |||
| 5149b68237 | |||
| a6e7cca92b | |||
| 2c3700f4f8 | |||
| 1bcc63d5de | |||
| 9db3dfe675 | |||
| 9ee93bea60 | |||
| 04fd9f8c0e | |||
| 5f8e55a3a3 | |||
| 01ae26e869 | |||
| bf61c4af4e | |||
| f566a33865 | |||
| d96fac324b | |||
| c8129ce658 | |||
| 5b0783097d | |||
| 9cde482dfe | |||
| 8e793ea37f | |||
| dde1212a57 | |||
| 6527eec133 | |||
| 2109903ba2 | |||
| 46dc2d4682 | |||
| 3c9d0dae22 | |||
| b6a81848ea | |||
| 096fbb661d | |||
| 035c4ab000 | |||
| 1efff107f9 | |||
| 1795cd73c7 | |||
| 5f21126a62 | |||
| 2085588556 | |||
| 025a67ce45 | |||
| cb806e19b1 | |||
| d4680d258c | |||
| a832883f17 | |||
| c086285340 | |||
| 7fa05b0004 | |||
| 65cf893a5f | |||
| e20ee8e065 | |||
| 7d8723715c | |||
| 49bb348707 | |||
| ef6de1d12b | |||
| c76a4e2018 | |||
| e504f806a9 | |||
| 68d9767bd8 | |||
| ccbf6de863 | |||
| d3a315525e | |||
| 38e15ed562 | |||
| c7fba23e3b | |||
| b60583008b | |||
| 542895c61c | |||
| 538e153473 | |||
| 78d1fd93c8 | |||
| 032f258912 | |||
| 9bd4a44ab6 | |||
| 4174c424fc | |||
| 0d946c050e | |||
| 95f020047d | |||
| 7fe519df28 | |||
| f0e36381d3 | |||
| 2c4d52ef63 | |||
| ded04de609 | |||
| 5152121c33 | |||
| 470474c189 | |||
| bf5635f8e3 | |||
| 7903c0c133 | |||
| 4cade1ab94 | |||
| 27de8213f2 |
@@ -38,10 +38,10 @@ module.exports = {
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_|props|watch',
|
||||
caughtErrorsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
@@ -64,6 +64,11 @@ module.exports = {
|
||||
'vue/no-parsing-error': 'off',
|
||||
'vue/no-deprecated-v-on-native-modifier': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/no-reserved-component-names': 'off',
|
||||
'vue/no-v-for-template-key': 'off',
|
||||
'vue/no-unused-vars': 'off',
|
||||
'vue/no-mutating-props': 'off',
|
||||
'no-mixed-spaces-and-tabs': 'off',
|
||||
'no-useless-escape': 'off',
|
||||
'no-sparse-arrays': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
@@ -77,8 +82,8 @@ module.exports = {
|
||||
'no-unused-vars': 'off',
|
||||
'no-v-model-argument': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
'no-console': 'error',
|
||||
'no-debugger': 'error',
|
||||
'no-console': 'off',
|
||||
'no-debugger': 'warn',
|
||||
'no-redeclare': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
11
.gitea/workflows/deploy.yaml
Normal file
11
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
name: 自动部署
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
部署应用:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 启动部署
|
||||
run: |
|
||||
docker exec gitea-runner /opt/deploy.sh
|
||||
@@ -1,68 +0,0 @@
|
||||
name: 全局K3s部署
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
jobs:
|
||||
deploy:
|
||||
# ========== 核心修复:替换为具体Ubuntu版本,解决运行期匹配问题 ==========
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
# 从组织级Secrets读取,不用在仓库重复配置
|
||||
K3S_HOST: ${{ secrets.K3S_HOST }}
|
||||
APP_NAME: ${{ gitea.repo_name }}
|
||||
# 补充:若后续要推送镜像,需替换为实际镜像仓库地址(比如你的Gitea镜像仓库)
|
||||
REGISTRY: 116.204.74.41:3000/red-future
|
||||
steps:
|
||||
# ========== 核心:新增国内Git代理,彻底解决GitHub拉取慢 ==========
|
||||
- name: 配置国内GitHub代理加速
|
||||
run: |
|
||||
# 全局Git代理:所有GitHub请求走国内镜像站
|
||||
git config --global url."https://ghproxy.com/https://github.com/".insteadOf "https://github.com/"
|
||||
# 可选:替换Ubuntu源为清华源,加速依赖安装
|
||||
sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
|
||||
apt update -y
|
||||
# ========== 核心修改:替换checkout源,避开GitHub ==========
|
||||
- name: 拉取代码(Gitea官方源)
|
||||
uses: gitea/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # 可选:拉取完整历史,加速后续操作
|
||||
timeout-minutes: 10 # 增加超时,避免拉取中断
|
||||
|
||||
# 1. 初始化 Docker Buildx(原内容不变)
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# 2. 可选:登录镜像仓库(若需推送镜像,取消注释并配置密钥)
|
||||
# - name: Login to Gitea Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: 116.204.74.41:3000
|
||||
# username: ${{ secrets.GITEA_USER }}
|
||||
# password: ${{ secrets.GITEA_PWD }}
|
||||
|
||||
# 3. 构建+推送(原内容不变)
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.APP_NAME }}:${{ gitea.sha }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.APP_NAME }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.APP_NAME }}:buildcache,mode=max
|
||||
|
||||
# 4. 修复后的SSH部署步骤(解决路径+命名空间问题)
|
||||
- name: SSH部署K3s
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.K3S_PEM_KEY }}" > k3s.pem
|
||||
chmod 600 k3s.pem
|
||||
|
||||
# ========== 修正1:上传仓库根目录的deploy.yaml到K3s临时目录 ==========
|
||||
scp -i k3s.pem -o StrictHostKeyChecking=no ./deploy.yaml root@${K3S_HOST}:/tmp/
|
||||
|
||||
# ========== 修正2:kubectl指向临时文件+补充命名空间 ==========
|
||||
ssh -i k3s.pem -o StrictHostKeyChecking=no root@${K3S_HOST} << CMD
|
||||
kubectl apply -f /tmp/deploy.yaml
|
||||
kubectl rollout restart deployment ${APP_NAME} -n default
|
||||
rm -f /tmp/deploy.yaml # 可选:清理临时文件
|
||||
CMD
|
||||
110
CLAUDE.md
Normal file
110
CLAUDE.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This is the **GFast UI** project (`gfast-ui`), a Vue 3 admin management system based on the vue-next-admin template, customized for a digital advertising/trading platform.
|
||||
|
||||
## Commands
|
||||
|
||||
- `npm install` - Install dependencies (use `npm install --registry=https://registry.npmmirror.com` for China mainland)
|
||||
- `npm run dev` - Start development server
|
||||
- `npm run build` - Build for production
|
||||
- `npm run lint` - Run ESLint check
|
||||
- `npm run lint-fix` - Fix ESLint issues automatically
|
||||
- `npm run type-check` - Run TypeScript type checking
|
||||
- `npm run quality` - Run both lint and type-check
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
**Tech Stack:**
|
||||
- Vue 3 with Composition API (script setup)
|
||||
- TypeScript
|
||||
- Vite
|
||||
- Element Plus (UI framework)
|
||||
- Pinia (state management)
|
||||
- Vue Router (with hash mode)
|
||||
- Axios (HTTP client)
|
||||
- i18n (internationalization)
|
||||
- mitt (event bus)
|
||||
|
||||
**Directory Structure:**
|
||||
- `src/api/` - API client methods organized by business domain (ads, assets, cid, customerService, digitalHuman, knowledge, login, menu, settings, system, etc.)
|
||||
- `src/components/` - Reusable Vue components
|
||||
- `src/directives/` - Custom Vue directives
|
||||
- `src/i18n/` - Internationalization configuration
|
||||
- `src/layout/` - Main layout components
|
||||
- `src/router/` - Route configuration
|
||||
- `index.ts` - Router setup and guard
|
||||
- `backEnd.ts` - Backend-controlled route initialization
|
||||
- `frontEnd.ts` - Frontend-controlled route initialization
|
||||
- `route.ts` - Static route definitions
|
||||
- `src/stores/` - Pinia state stores
|
||||
- `themeConfig.ts` - Theme and global configuration
|
||||
- `userInfo.ts` - User information
|
||||
- `routesList.ts` - Dynamic route management
|
||||
- `keepAliveNames.ts` - keep-alive cache management
|
||||
- `src/theme/` - Theme related styles
|
||||
- `src/types/` - TypeScript type definitions
|
||||
- `src/utils/` - Utility functions
|
||||
- `request.ts` - Axios instance with interceptors, error handling, and token management
|
||||
- `storage.ts` - Session storage wrapper
|
||||
- `gfast.ts` - GFast-specific helpers (file URL construction, tree building, date formatting)
|
||||
- `diffUtils.ts` - Field change detection for PUT requests
|
||||
- `src/views/` - Page components organized by business module
|
||||
|
||||
**Key Patterns:**
|
||||
|
||||
1. **Routing**: Supports both frontend and backend controlled routing. When backend control is enabled (`isRequestRoutes: true` in themeConfig), routes are fetched from the backend and dynamically added.
|
||||
|
||||
2. **API Requests**:
|
||||
- API methods are organized by domain in `src/api/` (each subdomain has its own directory structure)
|
||||
- The Axios instance in `src/utils/request.ts` is pre-configured with:
|
||||
- 50 second request timeout
|
||||
- `qs` serialization of query parameters with dot notation for nested objects
|
||||
- Automatically adds Bearer token (from cookies via Session utility) to all requests
|
||||
- Automatically sends only changed fields for PUT requests (diff comparison with original data via `_originalData` field)
|
||||
- Handles token expiration globally with redirect to login (prevents multiple overlapping popups)
|
||||
- Provides error message extraction from multiple response formats (`message`, `msg`, `error`, `detail`)
|
||||
- Error throttling: maximum one error message every 2 seconds
|
||||
- Supports error mode configuration via `requestOptions.errorMode`:
|
||||
- `global`: (default) Global error popup with backend message
|
||||
- `page`: No automatic popup, reject the error for page-level handling
|
||||
- `silent`: Completely silent, no error display
|
||||
- Special handling for `code === 402`: Triggers module not enabled subscription flow (except for specific asset endpoints)
|
||||
- Response format expects `code`, `message`/`msg`, and data. Known success codes: `0`, `200`.
|
||||
- Use `getApiErrorMessage(error)` from `/@/utils/request` to extract user-friendly error messages in catch blocks when using `page` or `silent` mode.
|
||||
|
||||
3. **Global Properties & Components**:
|
||||
- Helpers registered globally for template use:
|
||||
- `getUpFileUrl`, `handleTree`, `useDict`, `selectDictLabel`, `parseTime`, `getItems`, `setItems`, `getOptionValue`, `isEmpty`
|
||||
- Global components:
|
||||
- `pagination` - Reusable pagination component
|
||||
- Global plugins registered:
|
||||
- `vue-simple-uploader` - Large file upload component
|
||||
- Global event bus via mitt: `app.config.globalProperties.mittBus`
|
||||
|
||||
4. **Authentication**:
|
||||
- Token is stored in cookies via `js-cookie` (through the `Session` utility). Other user session data is stored in `sessionStorage`.
|
||||
- The `Session.clearAuth()` method only clears authentication-related keys (`token`, `userInfo`, `userMenu`, `permissions`), preserving other local preferences.
|
||||
- 401 responses (HTTP or business code) containing token expiration signals trigger automatic logout with a single confirmation popup.
|
||||
|
||||
5. **Keep-alive**: Route components can be cached via keep-alive, managed by the `useKeepALiveNames` store.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `.env.development` - Development environment settings
|
||||
- `.env.production` - Production environment settings
|
||||
- `VITE_API_URL` - Backend API base URL
|
||||
- `VITE_PORT` - Dev server port
|
||||
- `VITE_PUBLIC_PATH` - Public base path for production build
|
||||
- `VITE_OPEN_CDN` - Enable CDN for external dependencies
|
||||
|
||||
## Development Notes
|
||||
|
||||
- The project uses `/@` alias for `src/`
|
||||
- Components use the Composition API with `<script setup lang="ts">`
|
||||
- Styling is done with SCSS
|
||||
- ESLint enforces code quality
|
||||
- Node version requirement: `>=16.0.0` (supported: v16.x ~ v20.x)
|
||||
@@ -24,6 +24,6 @@ COPY ngnix.conf /etc/nginx/conf.d/default.conf
|
||||
# 复制SSL证书
|
||||
COPY ssl/* /etc/nginx/ssl/
|
||||
|
||||
EXPOSE 443
|
||||
EXPOSE 80 443
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
44
deploy.yaml
44
deploy.yaml
@@ -1,44 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ${APP_NAME}
|
||||
namespace: default
|
||||
labels:
|
||||
app: ${APP_NAME}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ${APP_NAME}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ${APP_NAME}
|
||||
spec:
|
||||
containers:
|
||||
- name: ${APP_NAME}
|
||||
image: ${REGISTRY}/${APP_NAME}:${gitea.sha}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80 # 你的项目实际端口(比如前端80、后端8080)
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ${APP_NAME}-service
|
||||
namespace: default
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: ${APP_NAME}
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30001 # 必须在30000-32767之间
|
||||
26
k8s/deployment.yaml
Normal file
26
k8s/deployment.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: admin-ui
|
||||
namespace: default
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: admin-ui
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: admin-ui
|
||||
spec:
|
||||
containers:
|
||||
- name: admin-ui
|
||||
image: 116.204.74.41:3000/red-future/admin-ui:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- containerPort: 443
|
||||
resources:
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
20
k8s/ingress.yaml
Normal file
20
k8s/ingress.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: admin-ui
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
|
||||
spec:
|
||||
tls:
|
||||
- secretName: admin-ui-tls
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: admin-ui
|
||||
port:
|
||||
number: 443
|
||||
15
k8s/service.yaml
Normal file
15
k8s/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: admin-ui
|
||||
spec:
|
||||
selector:
|
||||
app: admin-ui
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
- name: https
|
||||
port: 443
|
||||
targetPort: 443
|
||||
type: ClusterIP
|
||||
11
ngnix.conf
11
ngnix.conf
@@ -1,5 +1,12 @@
|
||||
# Nginx 静态文件服务 + 智能代理
|
||||
|
||||
# HTTP 重定向到 HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
# 静态资源根目录(dist)
|
||||
root /usr/share/nginx/html;
|
||||
@@ -7,8 +14,8 @@ server {
|
||||
|
||||
# SSL 配置
|
||||
listen 443 ssl;
|
||||
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||
ssl_certificate /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
|
||||
201
package-lock.json
generated
201
package-lock.json
generated
@@ -14,6 +14,10 @@
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@logicflow/core": "^2.2.1",
|
||||
"@logicflow/extension": "^2.2.1",
|
||||
"@vue-flow/background": "^1.3.2",
|
||||
"@vue-flow/controls": "^1.1.3",
|
||||
"@vue-flow/core": "^1.48.2",
|
||||
"@vue-flow/minimap": "^1.5.4",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"axios": "1.8.2",
|
||||
"codemirror": "^6.0.1",
|
||||
@@ -2243,6 +2247,98 @@
|
||||
"vscode-uri": "^3.0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/background": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@vue-flow/background/-/background-1.3.2.tgz",
|
||||
"integrity": "sha512-eJPhDcLj1wEo45bBoqTXw1uhl0yK2RaQGnEINqvvBsAFKh/camHJd5NPmOdS1w+M9lggc9igUewxaEd3iCQX2w==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@vue-flow/core": "^1.23.0",
|
||||
"vue": "^3.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/controls": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@vue-flow/controls/-/controls-1.1.3.tgz",
|
||||
"integrity": "sha512-XCf+G+jCvaWURdFlZmOjifZGw3XMhN5hHlfMGkWh9xot+9nH9gdTZtn+ldIJKtarg3B21iyHU8JjKDhYcB6JMw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@vue-flow/core": "^1.23.0",
|
||||
"vue": "^3.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/core": {
|
||||
"version": "1.48.2",
|
||||
"resolved": "https://registry.npmjs.org/@vue-flow/core/-/core-1.48.2.tgz",
|
||||
"integrity": "sha512-raxhgKWE+G/mcEvXJjGFUDYW9rAI3GOtiHR3ZkNpwBWuIaCC1EYiBmKGwJOoNzVFgwO7COgErnK7i08i287AFA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^10.5.0",
|
||||
"d3-drag": "^3.0.0",
|
||||
"d3-interpolate": "^3.0.1",
|
||||
"d3-selection": "^3.0.0",
|
||||
"d3-zoom": "^3.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/core/node_modules/@types/web-bluetooth": {
|
||||
"version": "0.0.20",
|
||||
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz",
|
||||
"integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@vue-flow/core/node_modules/@vueuse/core": {
|
||||
"version": "10.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.11.1.tgz",
|
||||
"integrity": "sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/web-bluetooth": "^0.0.20",
|
||||
"@vueuse/metadata": "10.11.1",
|
||||
"@vueuse/shared": "10.11.1",
|
||||
"vue-demi": ">=0.14.8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/core/node_modules/@vueuse/metadata": {
|
||||
"version": "10.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.11.1.tgz",
|
||||
"integrity": "sha512-IGa5FXd003Ug1qAZmyE8wF3sJ81xGLSqTqtQ6jaVfkeZ4i5kS2mwQF61yhVqojRnenVew5PldLyRgvdl4YYuSw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/core/node_modules/@vueuse/shared": {
|
||||
"version": "10.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.11.1.tgz",
|
||||
"integrity": "sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"vue-demi": ">=0.14.8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue-flow/minimap": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@vue-flow/minimap/-/minimap-1.5.4.tgz",
|
||||
"integrity": "sha512-l4C+XTAXnRxsRpUdN7cAVFBennC1sVRzq4bDSpVK+ag7tdMczAnhFYGgbLkUw3v3sY6gokyWwMl8CDonp8eB2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"d3-selection": "^3.0.0",
|
||||
"d3-zoom": "^3.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue-flow/core": "^1.23.0",
|
||||
"vue": "^3.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-core": {
|
||||
"version": "3.5.25",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz",
|
||||
@@ -2950,6 +3046,111 @@
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-color": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
||||
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-dispatch": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz",
|
||||
"integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-drag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz",
|
||||
"integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-selection": "3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-ease": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
|
||||
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-interpolate": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
||||
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-selection": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
|
||||
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-timer": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
|
||||
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-transition": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz",
|
||||
"integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3",
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-ease": "1 - 3",
|
||||
"d3-interpolate": "1 - 3",
|
||||
"d3-timer": "1 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"d3-selection": "2 - 3"
|
||||
}
|
||||
},
|
||||
"node_modules/d3-zoom": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz",
|
||||
"integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-drag": "2 - 3",
|
||||
"d3-interpolate": "1 - 3",
|
||||
"d3-selection": "2 - 3",
|
||||
"d3-transition": "2 - 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.19",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@logicflow/core": "^2.2.1",
|
||||
"@logicflow/extension": "^2.2.1",
|
||||
"@vue-flow/background": "^1.3.2",
|
||||
"@vue-flow/controls": "^1.1.3",
|
||||
"@vue-flow/core": "^1.48.2",
|
||||
"@vue-flow/minimap": "^1.5.4",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"axios": "1.8.2",
|
||||
"codemirror": "^6.0.1",
|
||||
|
||||
@@ -5,30 +5,42 @@ export interface knowledgeQueryParams {
|
||||
keyword?: string;
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
datasetType?: number; // 1=文本,2=视频
|
||||
}
|
||||
|
||||
// 创建知识库参数
|
||||
export interface CreateknowledgeParams {
|
||||
name: string; // 必传
|
||||
datasetType: number; // 1=文本,2=视频
|
||||
description?: string; // 可选
|
||||
embeddingModel?: string; // 向量模型
|
||||
status?: string; // 状态
|
||||
}
|
||||
|
||||
// 更新知识库参数
|
||||
export interface UpdateknowledgeParams {
|
||||
id: string; // 必传
|
||||
name?: string; // 可选
|
||||
datasetType?: number; // 1=文本,2=视频
|
||||
description?: string; // 可选
|
||||
embeddingModel?: string; // 向量模型
|
||||
status?: string; // 状态
|
||||
}
|
||||
|
||||
// 数据集信息
|
||||
export interface knowledgeInfo {
|
||||
id?: string;
|
||||
name: string;
|
||||
datasetType?: number; // 1=文本,2=视频
|
||||
description?: string;
|
||||
fileCount?: number;
|
||||
totalSize?: number;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
embeddingModel?: string; // 向量模型
|
||||
documentCount?: number; // 文档数量
|
||||
charCount?: number; // 字符数量
|
||||
status?: string; // 状态
|
||||
}
|
||||
|
||||
// 获取知识库列表
|
||||
|
||||
@@ -20,6 +20,41 @@ export interface ModelFormEntry {
|
||||
value: string;
|
||||
}
|
||||
|
||||
// 提示词管理接口类型
|
||||
export interface PromptItem {
|
||||
id: number | string;
|
||||
tenantId?: number;
|
||||
creator?: string;
|
||||
createdAt?: string;
|
||||
updater?: string;
|
||||
updatedAt?: string;
|
||||
deletedAt?: string | null;
|
||||
nodeType: string;
|
||||
prompt: string;
|
||||
sourceType: number; // 0-自定义 1-公共
|
||||
}
|
||||
|
||||
export interface PromptListResponse {
|
||||
list: PromptItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface PromptListParams {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
keyword?: string;
|
||||
}
|
||||
|
||||
export interface CreatePromptParams {
|
||||
nodeType: string;
|
||||
prompt: string;
|
||||
sourceType: number;
|
||||
}
|
||||
|
||||
export interface UpdatePromptParams extends CreatePromptParams {
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
/** 模型类型(listType 接口项,字段名以后端为准,前端做兼容解析) */
|
||||
export interface ModelTypeListItem {
|
||||
id?: number | string;
|
||||
@@ -127,6 +162,7 @@ export interface CreateModelParams {
|
||||
extendMapping?: Record<string, unknown>;
|
||||
responseTokenField?: string;
|
||||
tokenConfig?: Record<string, unknown>;
|
||||
queryConfig?: Record<string, unknown>;
|
||||
maxConcurrency?: number;
|
||||
queueLimit?: number;
|
||||
timeoutSeconds: number;
|
||||
@@ -250,3 +286,46 @@ export function getOperatorList() {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户提示词列表
|
||||
*/
|
||||
export function getMyPromptList(params: PromptListParams) {
|
||||
return request<PromptListResponse>({
|
||||
url: '/node/prompt/listMy',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建提示词
|
||||
*/
|
||||
export function createPrompt(data: CreatePromptParams) {
|
||||
return request({
|
||||
url: '/node/prompt/create',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改提示词
|
||||
*/
|
||||
export function updatePrompt(data: UpdatePromptParams) {
|
||||
return request({
|
||||
url: '/node/prompt/update',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除提示词
|
||||
*/
|
||||
export function deletePrompt(id: number | string) {
|
||||
return request({
|
||||
url: `/node/prompt/delete/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
110
src/api/settings/promptManager/index.ts
Normal file
110
src/api/settings/promptManager/index.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import request from '/@/utils/request';
|
||||
|
||||
// 提示词管理接口类型
|
||||
export interface PromptItem {
|
||||
id: number | string;
|
||||
tenantId?: number;
|
||||
creator?: string;
|
||||
createdAt?: string;
|
||||
updater?: string;
|
||||
updatedAt?: string;
|
||||
deletedAt?: string | null;
|
||||
nodeType: string;
|
||||
prompt: string;
|
||||
sourceType: number; // 0-自定义 1-公共
|
||||
}
|
||||
|
||||
export interface PromptListResponse {
|
||||
list: PromptItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface PromptListParams {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
keyword?: string;
|
||||
}
|
||||
|
||||
export interface CreatePromptParams {
|
||||
nodeType: string;
|
||||
prompt: string;
|
||||
sourceType: number;
|
||||
}
|
||||
|
||||
export interface UpdatePromptParams extends CreatePromptParams {
|
||||
id: number | string;
|
||||
}
|
||||
|
||||
// 节点库项接口类型
|
||||
export interface NodeLibraryNode {
|
||||
nodeId: string;
|
||||
nodeCode: string;
|
||||
modelType: number;
|
||||
nodeName: string;
|
||||
skillOption: boolean;
|
||||
promptOption: boolean;
|
||||
}
|
||||
|
||||
export interface NodeLibraryGroup {
|
||||
group: string;
|
||||
label: string;
|
||||
items: NodeLibraryNode[];
|
||||
}
|
||||
|
||||
export interface NodeLibraryResponse {
|
||||
groups: NodeLibraryGroup[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点类型列表(节点库)
|
||||
*/
|
||||
export function getNodeLibraryList() {
|
||||
return request<NodeLibraryResponse>({
|
||||
url: '/ai-agent/node/library/list',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户提示词列表
|
||||
*/
|
||||
export function getMyPromptList(params: PromptListParams) {
|
||||
return request<PromptListResponse>({
|
||||
url: '/ai-agent/node/prompt/listMy',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建提示词
|
||||
*/
|
||||
export function createPrompt(data: CreatePromptParams) {
|
||||
return request({
|
||||
url: '/ai-agent/node/prompt/create',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改提示词
|
||||
*/
|
||||
export function updatePrompt(data: UpdatePromptParams) {
|
||||
return request({
|
||||
url: '/ai-agent/node/prompt/update',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除提示词
|
||||
*/
|
||||
export function deletePrompt(id: number | string) {
|
||||
return request({
|
||||
url: '/ai-agent/node/prompt/delete',
|
||||
method: 'delete',
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="search-bar">
|
||||
<el-input v-model="searchParams.modelName" placeholder="搜索模型名称" clearable @clear="handleSearch">
|
||||
<template #prefix
|
||||
><el-icon><Search /></el-icon
|
||||
><el-icon> <Search /> </el-icon
|
||||
></template>
|
||||
</el-input>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
@@ -26,7 +26,9 @@
|
||||
<div class="model-type">{{ getModelTypeName(model.modelType) }}</div>
|
||||
<div class="model-badges">
|
||||
<el-tag v-if="model.isOwner === 0" type="warning" size="small">内置模型</el-tag>
|
||||
<el-icon v-if="selectedModel?.id === model.id" class="check-icon" color="#67c23a"><CircleCheck /></el-icon>
|
||||
<el-icon v-if="selectedModel?.id === model.id" class="check-icon" color="#67c23a">
|
||||
<CircleCheck />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-card-body">
|
||||
@@ -121,6 +123,7 @@ interface ModelItem {
|
||||
responseBody?: Record<string, unknown>;
|
||||
tokenConfig?: Record<string, unknown> | string;
|
||||
extendMapping?: Record<string, unknown> | string;
|
||||
queryConfig?: Record<string, unknown>;
|
||||
form?: ModelFormEntry[] | Record<string, unknown>;
|
||||
requestMapping?: Record<string, unknown>;
|
||||
responseMapping?: Record<string, unknown>;
|
||||
@@ -216,9 +219,28 @@ watch(
|
||||
|
||||
const getModelTypeName = (type: number | string) => {
|
||||
const typeMap: Record<number, string> = {
|
||||
1: '推理模型',
|
||||
2: '图片模型',
|
||||
3: '音频模型',
|
||||
100: '推理模型',
|
||||
200: '图片模型',
|
||||
201: '图片模型-文生图',
|
||||
202: '图片模型-图生图',
|
||||
203: '图片模型-图片编辑',
|
||||
204: '图片模型-图片变体',
|
||||
300: '音频模型',
|
||||
301: '音频模型-文生音',
|
||||
302: '音频模型-音生文',
|
||||
303: '音频模型-音生音',
|
||||
400: '向量化模型',
|
||||
401: '向量化模型-文本嵌入',
|
||||
402: '向量化模型-重排序',
|
||||
500: '全模态模型',
|
||||
501: '全模态模型-文图音',
|
||||
502: '全模态模型-视觉理解',
|
||||
600: '视频模型',
|
||||
601: '视频模型-文生视频',
|
||||
602: '视频模型-图生视频',
|
||||
603: '视频模型-图文生视频',
|
||||
604: '视频模型-视频生视频',
|
||||
605: '视频模型-视频编辑',
|
||||
};
|
||||
return typeMap[Number(type)] || '未知类型';
|
||||
};
|
||||
@@ -239,6 +261,85 @@ const parseJsonObjectField = (raw: unknown): Record<string, unknown> => {
|
||||
}
|
||||
return {};
|
||||
};
|
||||
const fieldsToUnknownObject = (fields: Array<{ key: string; value: string }>) => {
|
||||
const obj: Record<string, unknown> = {};
|
||||
fields.forEach((f) => {
|
||||
const k = String(f.key || '').trim();
|
||||
if (!k) return;
|
||||
obj[k] = String(f.value ?? '');
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
const flattenNestedObject = (obj: Record<string, unknown>, prefix = ''): Array<{ key: string; value: string }> => {
|
||||
const rows: Array<{ key: string; value: string }> = [];
|
||||
Object.entries(obj || {}).forEach(([k, v]) => {
|
||||
const fk = prefix ? `${prefix}.${k}` : k;
|
||||
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
||||
rows.push(...flattenNestedObject(v as Record<string, unknown>, fk));
|
||||
return;
|
||||
}
|
||||
rows.push({ key: fk, value: String(v ?? '') });
|
||||
});
|
||||
return rows;
|
||||
};
|
||||
|
||||
const nestFieldsToObject = (fields: Array<{ key: string; value: string }>) => {
|
||||
const root: Record<string, unknown> = {};
|
||||
fields.forEach((f) => {
|
||||
const path = String(f.key || '').trim();
|
||||
if (!path) return;
|
||||
const parts = path
|
||||
.split('.')
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean);
|
||||
if (!parts.length) return;
|
||||
let cur: Record<string, unknown> = root;
|
||||
parts.forEach((part, idx) => {
|
||||
if (idx === parts.length - 1) {
|
||||
cur[part] = String(f.value ?? '');
|
||||
return;
|
||||
}
|
||||
if (!cur[part] || typeof cur[part] !== 'object' || Array.isArray(cur[part])) {
|
||||
cur[part] = {};
|
||||
}
|
||||
cur = cur[part] as Record<string, unknown>;
|
||||
});
|
||||
});
|
||||
return root;
|
||||
};
|
||||
|
||||
const buildQueryConfigFromRaw = (rawQc: Record<string, unknown> | null): Record<string, unknown> => {
|
||||
if (!rawQc) return { responseType: 'sync', callbackUrl: '' };
|
||||
const rt = String(rawQc.responseType || 'sync');
|
||||
if (rt === 'callback') return { responseType: 'callback', callbackUrl: String(rawQc.callbackUrl || '') };
|
||||
if (rt === 'pull') {
|
||||
const hFields = Object.entries((rawQc.headers as Record<string, unknown>) || {}).map(([k, v]) => ({ key: k, value: String(v ?? '') }));
|
||||
const bFields = flattenNestedObject((rawQc.body as Record<string, unknown>) || {});
|
||||
return {
|
||||
responseType: 'pull',
|
||||
callbackUrl: '',
|
||||
method: String(rawQc.method || 'GET'),
|
||||
url: String(rawQc.url || ''),
|
||||
headers: fieldsToUnknownObject(hFields),
|
||||
body: nestFieldsToObject(bFields),
|
||||
response: ((rawQc.response as unknown[]) || [])
|
||||
.map((item) => {
|
||||
if (typeof item === 'string') {
|
||||
return { value: item, isTokenField: false, isMainBody: false };
|
||||
}
|
||||
const row = item as Record<string, unknown>;
|
||||
return {
|
||||
value: String(row.value ?? ''),
|
||||
isTokenField: Boolean(row.isTokenField),
|
||||
isMainBody: Boolean(row.isMainBody),
|
||||
};
|
||||
})
|
||||
.filter((row) => row.value !== ''),
|
||||
};
|
||||
}
|
||||
return { responseType: 'sync', callbackUrl: '' };
|
||||
};
|
||||
|
||||
const fetchModelList = async () => {
|
||||
loading.value = true;
|
||||
@@ -325,8 +426,17 @@ const handleCreatePrivateModel = async () => {
|
||||
autoCleanSeconds: builtInModel.autoCleanSeconds || 300,
|
||||
remark: builtInModel.remark || '',
|
||||
|
||||
extendMapping: parseJsonObjectField(builtInModel.extendMapping),
|
||||
tokenConfig: parseJsonObjectField(builtInModel.tokenConfig),
|
||||
extendMapping: fieldsToUnknownObject(
|
||||
Object.entries(parseJsonObjectField(builtInModel.extendMapping)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
||||
),
|
||||
tokenConfig: fieldsToUnknownObject(
|
||||
Object.entries(parseJsonObjectField(builtInModel.tokenConfig)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
||||
),
|
||||
queryConfig: buildQueryConfigFromRaw(
|
||||
builtInModel.queryConfig && typeof builtInModel.queryConfig === 'object' && !Array.isArray(builtInModel.queryConfig)
|
||||
? (builtInModel.queryConfig as Record<string, unknown>)
|
||||
: null
|
||||
),
|
||||
};
|
||||
|
||||
const res: any = await addModelModule(createParams);
|
||||
|
||||
@@ -32,22 +32,12 @@
|
||||
<div class="table-body">
|
||||
<div v-for="(attr, index) in ruleForm.attrs" :key="index" class="table-row">
|
||||
<div class="col col-name">
|
||||
<el-input
|
||||
v-if="!isDictType(attr.type)"
|
||||
v-model="attr.name"
|
||||
placeholder="请输入属性名称"
|
||||
clearable
|
||||
/>
|
||||
<el-input v-if="!isDictType(attr.type)" v-model="attr.name" placeholder="请输入属性名称" clearable />
|
||||
<span v-else class="dict-name">{{ attr.name || '请选择字典' }}</span>
|
||||
</div>
|
||||
<div class="col col-type">
|
||||
<el-select v-model="attr.type" placeholder="属性类型" class="w100" @change="onAttrTypeChange(attr)">
|
||||
<el-option
|
||||
v-for="item in attrTypeOptions"
|
||||
:key="item.key"
|
||||
:label="item.value"
|
||||
:value="item.key"
|
||||
/>
|
||||
<el-option v-for="item in attrTypeOptions" :key="item.key" :label="item.value" :value="item.key" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="col col-required">
|
||||
@@ -155,13 +145,6 @@ interface DictInfo {
|
||||
remark: string;
|
||||
}
|
||||
|
||||
interface DictValue {
|
||||
key: string;
|
||||
value: string;
|
||||
isDefault: number;
|
||||
remark: string;
|
||||
}
|
||||
|
||||
interface RuleForm {
|
||||
id: string | '';
|
||||
parentId: string;
|
||||
@@ -219,15 +202,11 @@ const fetchDictTypeOptions = () => {
|
||||
.then((res: any) => {
|
||||
const list = res.data?.list ?? [];
|
||||
// 提取所有字典类型信息
|
||||
dictTypeOptions.value = list
|
||||
.map((item: any) => item.info)
|
||||
.filter((info: DictInfo) => info && info.name);
|
||||
dictTypeOptions.value = list.map((item: any) => item.info).filter((info: DictInfo) => info && info.name);
|
||||
// 保存完整的字典数据列表(包含info和values)
|
||||
dictValueOptions.value = list;
|
||||
|
||||
})
|
||||
.catch((err: any) => {
|
||||
|
||||
dictTypeOptions.value = [];
|
||||
dictValueOptions.value = [];
|
||||
})
|
||||
@@ -270,7 +249,9 @@ const isDictOptionDisabled = (dictName: string, currentAttr: CustomAttr) => {
|
||||
const dictInfo = dictTypeOptions.value.find((item) => item.name === dictName);
|
||||
const dictType = dictInfo?.type || '';
|
||||
// 检查该字典是否已被其他属性使用(使用 dictType 判断)
|
||||
return ruleForm.attrs.some((attr) => attr !== currentAttr && isDictType(attr.type) && (attr.dictType === dictType || (!attr.dictType && attr.name === dictName)));
|
||||
return ruleForm.attrs.some(
|
||||
(attr) => attr !== currentAttr && isDictType(attr.type) && (attr.dictType === dictType || (!attr.dictType && attr.name === dictName))
|
||||
);
|
||||
};
|
||||
|
||||
// 添加自定义属性
|
||||
@@ -325,16 +306,16 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => {
|
||||
// 获取分类树数据
|
||||
getCategoryTree().then((res: any) => {
|
||||
const tree = res.data?.tree ?? [];
|
||||
|
||||
|
||||
// 递归函数,将所有id字段转换为字符串
|
||||
const convertIdsToString = (items: any[]): any[] => {
|
||||
return items.map(item => ({
|
||||
return items.map((item) => ({
|
||||
...item,
|
||||
id: item.id?.toString(),
|
||||
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : []
|
||||
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : [],
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
categoryData.value = convertIdsToString(tree);
|
||||
});
|
||||
|
||||
@@ -472,7 +453,7 @@ const onSubmit = () => {
|
||||
...submitData,
|
||||
_originalData: originalData,
|
||||
};
|
||||
|
||||
|
||||
updateCategory(requestData)
|
||||
.then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
|
||||
121
src/views/home/components/ChatList.vue
Normal file
121
src/views/home/components/ChatList.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class="chat-list">
|
||||
<div class="chat-divider">今天 15:14</div>
|
||||
|
||||
<div v-for="msg in messages" :key="msg.id" class="message-row" :class="{ 'is-user': msg.isUser }">
|
||||
<div class="bubble-wrap">
|
||||
<div class="bubble">{{ msg.content }}</div>
|
||||
<div class="time">{{ msg.time }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
interface Message {
|
||||
id: number;
|
||||
content: string;
|
||||
time: string;
|
||||
isUser: boolean;
|
||||
}
|
||||
|
||||
const messages = ref<Message[]>([
|
||||
{
|
||||
id: 1,
|
||||
content: '你好!我叫知子,很高兴为您服务。您今天想聊些什么呢?',
|
||||
time: '09:30',
|
||||
isUser: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
content: '你好!我想了解下这个系统都能做什么。',
|
||||
time: '09:31',
|
||||
isUser: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?',
|
||||
time: '09:31',
|
||||
isUser: false,
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chat-list {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
gap: 16px;
|
||||
padding: 28px 0 10px;
|
||||
}
|
||||
|
||||
.chat-divider {
|
||||
align-self: center;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
line-height: 1;
|
||||
padding: 4px 16px;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(226, 233, 244, 0.8);
|
||||
letter-spacing: 0.2px;
|
||||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
|
||||
}
|
||||
|
||||
.message-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
max-width: 100%;
|
||||
|
||||
&.is-user {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.bubble-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
max-width: min(84%, 1120px);
|
||||
}
|
||||
|
||||
.bubble {
|
||||
font-size: 14px;
|
||||
line-height: 1.75;
|
||||
padding: 14px 16px;
|
||||
border-radius: 16px;
|
||||
word-break: break-word;
|
||||
color: #1f2937;
|
||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 255, 0.92) 100%);
|
||||
border: 1px solid rgba(226, 233, 244, 0.95);
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
.message-row.is-user & {
|
||||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
|
||||
border-color: rgba(59, 130, 246, 0.4);
|
||||
color: #fff;
|
||||
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
|
||||
}
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 11px;
|
||||
color: #8f9aae;
|
||||
padding: 4px 6px;
|
||||
|
||||
.message-row.is-user & {
|
||||
text-align: right;
|
||||
color: rgba(148, 163, 184, 0.9);
|
||||
}
|
||||
.message-row:not(.is-user) & {
|
||||
padding-left: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
164
src/views/home/components/CommandList.vue
Normal file
164
src/views/home/components/CommandList.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="command-list">
|
||||
<div v-for="command in commandList" :key="command.id" class="command-card" @click="handleCommandClick(command)">
|
||||
<div class="command-icon">
|
||||
<el-icon :size="32" color="#3b82f6">
|
||||
<Lightning />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="command-content">
|
||||
<h3 class="command-name">{{ command.name }}</h3>
|
||||
<p class="command-desc">{{ command.description }}</p>
|
||||
<div class="command-trigger">
|
||||
<el-tag size="small" type="info">{{ command.trigger }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="command-actions">
|
||||
<el-button text size="small" @click.stop="handleEdit(command)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" type="danger" @click.stop="handleDelete(command)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Lightning, Edit, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface Command {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
trigger: string;
|
||||
action: string;
|
||||
}
|
||||
|
||||
const commandList = ref<Command[]>([
|
||||
{
|
||||
id: 1,
|
||||
name: '快速创建组件',
|
||||
description: '快速创建一个 Vue 组件模板,包含基础结构和样式',
|
||||
trigger: '/component',
|
||||
action: 'create_component',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '生成 API 接口',
|
||||
description: '根据接口文档快速生成 API 请求函数',
|
||||
trigger: '/api',
|
||||
action: 'generate_api',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '代码格式化',
|
||||
description: '格式化当前文件的代码,统一代码风格',
|
||||
trigger: '/format',
|
||||
action: 'format_code',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '添加类型定义',
|
||||
description: '为 JavaScript 代码添加 TypeScript 类型定义',
|
||||
trigger: '/types',
|
||||
action: 'add_types',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '生成测试用例',
|
||||
description: '为当前组件或函数生成单元测试代码',
|
||||
trigger: '/test',
|
||||
action: 'generate_test',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '优化性能',
|
||||
description: '分析代码并提供性能优化建议',
|
||||
trigger: '/optimize',
|
||||
action: 'optimize_code',
|
||||
},
|
||||
]);
|
||||
|
||||
const handleCommandClick = (command: Command) => {
|
||||
ElMessage.success(`执行指令: ${command.name}`);
|
||||
};
|
||||
|
||||
const handleEdit = (command: Command) => {
|
||||
ElMessage.info(`编辑指令: ${command.name}`);
|
||||
};
|
||||
|
||||
const handleDelete = (command: Command) => {
|
||||
ElMessage.warning(`删除指令: ${command.name}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.command-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.command-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
border: 1px solid #e5e7eb;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
transform: translateY(-2px);
|
||||
border-color: #3b82f6;
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.command-icon {
|
||||
flex-shrink: 0;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.command-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.command-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.command-desc {
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
line-height: 1.5;
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.command-trigger {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.command-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
171
src/views/home/components/DiaryList.vue
Normal file
171
src/views/home/components/DiaryList.vue
Normal file
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<div class="diary-list">
|
||||
<div v-for="diary in diaryList" :key="diary.id" class="diary-card" @click="handleDiaryClick(diary)">
|
||||
<div class="diary-header">
|
||||
<div class="diary-date">
|
||||
<el-icon><Calendar /></el-icon>
|
||||
{{ diary.date }}
|
||||
</div>
|
||||
<el-tag :type="diary.mood === 'happy' ? 'success' : diary.mood === 'sad' ? 'danger' : 'warning'" size="small">
|
||||
{{ getMoodText(diary.mood) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<h3 class="diary-title">{{ diary.title }}</h3>
|
||||
<p class="diary-content">{{ diary.content }}</p>
|
||||
<div class="diary-footer">
|
||||
<div class="diary-tags">
|
||||
<el-tag v-for="tag in diary.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
|
||||
</div>
|
||||
<div class="diary-actions">
|
||||
<el-button text size="small" @click.stop="handleEdit(diary)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" type="danger" @click.stop="handleDelete(diary)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Calendar, Edit, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface Diary {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
date: string;
|
||||
mood: 'happy' | 'sad' | 'normal';
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
const diaryList = ref<Diary[]>([
|
||||
{
|
||||
id: 1,
|
||||
title: '今天学习了 Vue 3 新特性',
|
||||
content: '今天深入学习了 Vue 3 的 Composition API,感觉比 Options API 更加灵活和强大。特别是 setup 函数和响应式系统的改进,让代码组织更加清晰...',
|
||||
date: '2026-05-26',
|
||||
mood: 'happy',
|
||||
tags: ['学习', 'Vue3', '前端'],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '项目进度顺利',
|
||||
content: '今天完成了首页重构的基础布局,整体效果不错。明天继续完善功能模块和样式细节...',
|
||||
date: '2026-05-25',
|
||||
mood: 'happy',
|
||||
tags: ['工作', '项目'],
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '遇到了一些技术难题',
|
||||
content: '在处理复杂组件通信时遇到了一些问题,花了不少时间调试。最后通过重新设计数据流解决了...',
|
||||
date: '2026-05-24',
|
||||
mood: 'normal',
|
||||
tags: ['技术', '调试'],
|
||||
},
|
||||
]);
|
||||
|
||||
const getMoodText = (mood: string) => {
|
||||
const moodMap: Record<string, string> = {
|
||||
happy: '😊 开心',
|
||||
sad: '😢 难过',
|
||||
normal: '😐 平静',
|
||||
};
|
||||
return moodMap[mood] || '平静';
|
||||
};
|
||||
|
||||
const handleDiaryClick = (diary: Diary) => {
|
||||
ElMessage.info(`查看日记: ${diary.title}`);
|
||||
};
|
||||
|
||||
const handleEdit = (diary: Diary) => {
|
||||
ElMessage.info(`编辑日记: ${diary.title}`);
|
||||
};
|
||||
|
||||
const handleDelete = (diary: Diary) => {
|
||||
ElMessage.warning(`删除日记: ${diary.title}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.diary-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.diary-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
border: 1px solid #e5e7eb;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
transform: translateY(-2px);
|
||||
border-color: #3b82f6;
|
||||
}
|
||||
}
|
||||
|
||||
.diary-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.diary-date {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.diary-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0 0 12px 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.diary-content {
|
||||
font-size: 14px;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
margin: 0 0 16px 0;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.diary-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #f3f4f6;
|
||||
}
|
||||
|
||||
.diary-tags {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.diary-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
199
src/views/home/components/FileList.vue
Normal file
199
src/views/home/components/FileList.vue
Normal file
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<div class="file-list">
|
||||
<div v-for="file in fileList" :key="file.id" class="file-card" @click="handleFileClick(file)">
|
||||
<div class="file-icon">
|
||||
<el-icon :size="40" :color="getFileColor(file.type)">
|
||||
<component :is="getFileIcon(file.type)" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="file-info">
|
||||
<h3 class="file-name">{{ file.name }}</h3>
|
||||
<div class="file-meta">
|
||||
<span class="file-size">{{ file.size }}</span>
|
||||
<span class="file-date">{{ file.date }}</span>
|
||||
</div>
|
||||
<div class="file-tags">
|
||||
<el-tag v-for="tag in file.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="file-actions">
|
||||
<el-button text size="small" @click.stop="handleDownload(file)">
|
||||
<el-icon><Download /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" type="danger" @click.stop="handleDelete(file)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Document, Picture, VideoPlay, Folder, Download, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface FileItem {
|
||||
id: number;
|
||||
name: string;
|
||||
type: 'document' | 'image' | 'video' | 'folder';
|
||||
size: string;
|
||||
date: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
const fileList = ref<FileItem[]>([
|
||||
{
|
||||
id: 1,
|
||||
name: 'Vue3 学习笔记.pdf',
|
||||
type: 'document',
|
||||
size: '2.5 MB',
|
||||
date: '2026-05-26',
|
||||
tags: ['学习', '文档'],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '项目截图.png',
|
||||
type: 'image',
|
||||
size: '856 KB',
|
||||
date: '2026-05-25',
|
||||
tags: ['截图', '项目'],
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '演示视频.mp4',
|
||||
type: 'video',
|
||||
size: '15.3 MB',
|
||||
date: '2026-05-24',
|
||||
tags: ['视频', '演示'],
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '项目文档',
|
||||
type: 'folder',
|
||||
size: '12 个文件',
|
||||
date: '2026-05-23',
|
||||
tags: ['文件夹'],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'API 接口文档.docx',
|
||||
type: 'document',
|
||||
size: '1.2 MB',
|
||||
date: '2026-05-22',
|
||||
tags: ['文档', 'API'],
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'UI 设计稿.sketch',
|
||||
type: 'image',
|
||||
size: '4.8 MB',
|
||||
date: '2026-05-21',
|
||||
tags: ['设计', 'UI'],
|
||||
},
|
||||
]);
|
||||
|
||||
const getFileIcon = (type: string) => {
|
||||
const iconMap: Record<string, any> = {
|
||||
document: Document,
|
||||
image: Picture,
|
||||
video: VideoPlay,
|
||||
folder: Folder,
|
||||
};
|
||||
return iconMap[type] || Document;
|
||||
};
|
||||
|
||||
const getFileColor = (type: string) => {
|
||||
const colorMap: Record<string, string> = {
|
||||
document: '#3b82f6',
|
||||
image: '#10b981',
|
||||
video: '#f59e0b',
|
||||
folder: '#8b5cf6',
|
||||
};
|
||||
return colorMap[type] || '#6b7280';
|
||||
};
|
||||
|
||||
const handleFileClick = (file: FileItem) => {
|
||||
ElMessage.info(`打开文件: ${file.name}`);
|
||||
};
|
||||
|
||||
const handleDownload = (file: FileItem) => {
|
||||
ElMessage.success(`下载文件: ${file.name}`);
|
||||
};
|
||||
|
||||
const handleDelete = (file: FileItem) => {
|
||||
ElMessage.warning(`删除文件: ${file.name}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.file-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.file-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
border: 1px solid #e5e7eb;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
transform: translateY(-2px);
|
||||
border-color: #3b82f6;
|
||||
}
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
flex-shrink: 0;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f3f4f6;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.file-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0 0 8px 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.file-meta {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.file-tags {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.file-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
332
src/views/home/components/InputBar.vue
Normal file
332
src/views/home/components/InputBar.vue
Normal file
@@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<div class="input-shell">
|
||||
<div class="input-card">
|
||||
<el-input
|
||||
v-model="message"
|
||||
type="textarea"
|
||||
:rows="1"
|
||||
:autosize="{ minRows: 2, maxRows: 5 }"
|
||||
placeholder="多说说你的偏好和要求,我会越用越懂你"
|
||||
class="message-input"
|
||||
@keydown.enter.exact="handleSend"
|
||||
/>
|
||||
|
||||
<div class="input-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button circle class="tool-btn" @click="handleAttachment">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" @command="handleSkillSelect">
|
||||
<el-button class="pill-btn">
|
||||
{{ currentSkillDisplay }}
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="default">默认对话</el-dropdown-item>
|
||||
<el-dropdown-item command="code-review">代码审查</el-dropdown-item>
|
||||
<el-dropdown-item command="refactor">代码重构</el-dropdown-item>
|
||||
<el-dropdown-item command="writing">内容写作</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button circle class="send-btn" :disabled="!message.trim()" @click="handleSend">
|
||||
<el-icon><Top /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 常用工作流胶囊 -->
|
||||
<div class="workflow-pills" v-if="commonWorkflows.length > 0">
|
||||
<div
|
||||
v-for="wf in commonWorkflows"
|
||||
:key="wf.id"
|
||||
class="workflow-pill"
|
||||
:class="{ active: selectedWorkflowId === wf.id }"
|
||||
@click="selectWorkflow(wf)"
|
||||
>
|
||||
<el-icon class="pill-icon">
|
||||
<component :is="wf.icon" />
|
||||
</el-icon>
|
||||
<span class="pill-text">{{ wf.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { Top, Plus, MagicStick, Document, CircleCheck } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface Emits {
|
||||
(e: 'send', message: string): void;
|
||||
}
|
||||
|
||||
interface Workflow {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: any;
|
||||
prefix: string;
|
||||
editPath: string;
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
const router = useRouter();
|
||||
const message = ref('');
|
||||
const selectedSkill = ref('default');
|
||||
const selectedWorkflowId = ref<number | null>(null);
|
||||
|
||||
const skillLabels: Record<string, string> = {
|
||||
default: '选择技能',
|
||||
'code-review': '代码审查',
|
||||
refactor: '代码重构',
|
||||
writing: '内容写作',
|
||||
};
|
||||
|
||||
const currentSkillDisplay = computed(() => {
|
||||
return selectedSkill.value === 'default' ? '选择技能' : skillLabels[selectedSkill.value];
|
||||
});
|
||||
|
||||
const skills: Record<string, string> = {
|
||||
default: '',
|
||||
'code-review': '[技能:代码审查] 请帮我审查下面这段代码,找出潜在问题并给出改进建议:\n',
|
||||
refactor: '[技能:代码重构] 请帮我重构下面这段代码,提升可读性和可维护性:\n',
|
||||
writing: '[技能:内容写作] 请根据下面的需求帮我创作内容:\n',
|
||||
};
|
||||
|
||||
// 常用工作流列表
|
||||
const commonWorkflows: Workflow[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: '审查+测试',
|
||||
icon: Document,
|
||||
prefix: '[工作流:审查+测试] 完成后请自动生成单元测试:\n',
|
||||
editPath: '/settings/workflow',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '文档再编码',
|
||||
icon: Document,
|
||||
prefix: '[工作流:文档再编码] 请先编写接口文档,再实现代码:\n',
|
||||
editPath: '/settings/workflow',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '代码重构',
|
||||
icon: Document,
|
||||
prefix: '[工作流:代码重构] 请帮我重构这段代码:\n',
|
||||
editPath: '/settings/workflow',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '需求分析',
|
||||
icon: Document,
|
||||
prefix: '[工作流:需求分析] 请帮我分析这个需求并拆解任务:\n',
|
||||
editPath: '/settings/workflow',
|
||||
},
|
||||
];
|
||||
|
||||
const handleSend = (event?: KeyboardEvent) => {
|
||||
if (event) event.preventDefault();
|
||||
const msg = message.value.trim();
|
||||
if (!msg) return;
|
||||
const skillPrefix = skills[selectedSkill.value] || '';
|
||||
const workflowPrefix = selectedWorkflowId.value !== null ? commonWorkflows.find((w) => w.id === selectedWorkflowId.value)?.prefix || '' : '';
|
||||
const finalMessage = (skillPrefix + workflowPrefix + msg).trim();
|
||||
emit('send', finalMessage);
|
||||
message.value = '';
|
||||
// 发送后清空选择
|
||||
selectedWorkflowId.value = null;
|
||||
};
|
||||
|
||||
const handleAttachment = () => {
|
||||
ElMessage.info('附件上传功能开发中...');
|
||||
};
|
||||
|
||||
const handleSkillSelect = (key: string | number | object) => {
|
||||
selectedSkill.value = String(key);
|
||||
if (selectedSkill.value !== 'default') {
|
||||
ElMessage.success(`已选择技能:${skillLabels[selectedSkill.value]}`);
|
||||
}
|
||||
};
|
||||
|
||||
const selectWorkflow = (wf: Workflow) => {
|
||||
if (selectedWorkflowId.value === wf.id) {
|
||||
selectedWorkflowId.value = null;
|
||||
ElMessage.info('已取消工作流');
|
||||
} else {
|
||||
selectedWorkflowId.value = wf.id;
|
||||
ElMessage.success(`已选择工作流:${wf.name}`);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.input-shell {
|
||||
position: relative;
|
||||
z-index: 12;
|
||||
margin-top: -20px;
|
||||
padding: 0 0 50px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.input-card {
|
||||
width: min(1060px, 82%);
|
||||
margin: 0 auto;
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.94) 100%),
|
||||
radial-gradient(120% 180% at 0% 0%, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 38%),
|
||||
radial-gradient(80% 120% at 100% 100%, rgba(168, 85, 247, 0.08) 0%, rgba(168, 85, 247, 0) 38%);
|
||||
border: 1px solid rgba(59, 130, 246, 0.28);
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
0 24px 48px rgba(15, 23, 42, 0.12),
|
||||
0 0 0 1px rgba(59, 130, 246, 0.08) inset,
|
||||
0 8px 16px rgba(37, 99, 235, 0.1);
|
||||
padding: 16px 18px 18px;
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.message-input {
|
||||
:deep(.el-textarea__inner) {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
resize: none;
|
||||
padding: 8px 6px 14px;
|
||||
font-size: 15px;
|
||||
line-height: 1.65;
|
||||
color: #0f172a;
|
||||
background: transparent;
|
||||
min-height: 50px;
|
||||
font-weight: 500;
|
||||
|
||||
&::placeholder {
|
||||
color: #90a1b7;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.toolbar-left,
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.tool-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid #d9e4f5;
|
||||
color: #5b6b84;
|
||||
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
|
||||
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
color: #2b4d8f;
|
||||
background: linear-gradient(135deg, #f0f7ff 0%, #e0edff 100%);
|
||||
border-color: #bfdbfe;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
.pill-btn {
|
||||
height: 32px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid #dbe7f7;
|
||||
color: #30435f;
|
||||
background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #f0f7ff 0%, #e0edff 100%);
|
||||
border-color: #bfdbfe;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
|
||||
color: #fff;
|
||||
box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
filter: brightness(1.08);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
box-shadow: none;
|
||||
background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* 工作流胶囊样式 */
|
||||
.workflow-pills {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid rgba(59, 130, 246, 0.15);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.workflow-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(59, 130, 246, 0.3);
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
color: #475569;
|
||||
|
||||
&:hover {
|
||||
border-color: #3b82f6;
|
||||
background: rgba(59, 130, 246, 0.08);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: #3b82f6;
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
color: #ffffff;
|
||||
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
|
||||
.pill-icon {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.pill-text {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
88
src/views/home/components/MainContent.vue
Normal file
88
src/views/home/components/MainContent.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<div v-if="activeMenu !== 'chat'" class="content-header">
|
||||
<h2 class="content-title">{{ currentTitle }}</h2>
|
||||
<div class="content-actions">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-body">
|
||||
<div class="chat-container" v-if="activeMenu === 'chat'">
|
||||
<ChatList />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import ChatList from './ChatList.vue';
|
||||
|
||||
interface Props {
|
||||
activeMenu: string;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const menuTitles: Record<string, string> = {
|
||||
chat: '对话',
|
||||
models: '模型管理',
|
||||
creation: '内容创作',
|
||||
};
|
||||
|
||||
const currentTitle = computed(() => menuTitles[props.activeMenu] || '首页');
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #ffffff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 24px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.content-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.content-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
background:
|
||||
radial-gradient(1200px 420px at 58% -120px, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0) 65%),
|
||||
radial-gradient(900px 320px at 20% 120%, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 68%),
|
||||
linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
|
||||
|
||||
/* 隐藏滚动条但保持滚动功能 */
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.chat-container {
|
||||
width: min(1060px, 82%);
|
||||
margin: 0 auto;
|
||||
padding: 20px 0 130px;
|
||||
}
|
||||
</style>
|
||||
207
src/views/home/components/ReplyList.vue
Normal file
207
src/views/home/components/ReplyList.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<div class="reply-list">
|
||||
<div v-for="reply in replyList" :key="reply.id" class="reply-card" @click="handleReplyClick(reply)">
|
||||
<div class="reply-header">
|
||||
<div class="reply-category">
|
||||
<el-tag :type="getCategoryType(reply.category)" size="small">{{ reply.category }}</el-tag>
|
||||
</div>
|
||||
<div class="reply-usage">
|
||||
<el-icon><ChatDotRound /></el-icon>
|
||||
<span>{{ reply.usageCount }} 次使用</span>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="reply-title">{{ reply.title }}</h3>
|
||||
<p class="reply-content">{{ reply.content }}</p>
|
||||
<div class="reply-footer">
|
||||
<div class="reply-tags">
|
||||
<el-tag v-for="tag in reply.tags" :key="tag" size="small" effect="plain">{{ tag }}</el-tag>
|
||||
</div>
|
||||
<div class="reply-actions">
|
||||
<el-button text size="small" @click.stop="handleCopy(reply)">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" @click.stop="handleEdit(reply)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
<el-button text size="small" type="danger" @click.stop="handleDelete(reply)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ChatDotRound, CopyDocument, Edit, Delete } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface Reply {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
category: string;
|
||||
tags: string[];
|
||||
usageCount: number;
|
||||
}
|
||||
|
||||
const replyList = ref<Reply[]>([
|
||||
{
|
||||
id: 1,
|
||||
title: '欢迎语',
|
||||
content: '您好!很高兴为您服务。请问有什么可以帮助您的吗?',
|
||||
category: '问候',
|
||||
tags: ['欢迎', '问候'],
|
||||
usageCount: 156,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '感谢回复',
|
||||
content: '非常感谢您的反馈!我们会继续努力为您提供更好的服务。',
|
||||
category: '感谢',
|
||||
tags: ['感谢', '反馈'],
|
||||
usageCount: 89,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '技术支持',
|
||||
content: '我已经收到您的问题,正在为您查询相关信息。请稍等片刻,我会尽快回复您。',
|
||||
category: '支持',
|
||||
tags: ['技术', '支持'],
|
||||
usageCount: 234,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '道歉回复',
|
||||
content: '非常抱歉给您带来不便。我们会立即处理这个问题,并尽快给您一个满意的答复。',
|
||||
category: '道歉',
|
||||
tags: ['道歉', '问题'],
|
||||
usageCount: 45,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '结束语',
|
||||
content: '如果您还有其他问题,随时欢迎联系我们。祝您生活愉快!',
|
||||
category: '结束',
|
||||
tags: ['结束', '祝福'],
|
||||
usageCount: 178,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: '产品介绍',
|
||||
content: '我们的产品采用最新技术,为您提供高效、稳定、安全的服务体验。',
|
||||
category: '介绍',
|
||||
tags: ['产品', '介绍'],
|
||||
usageCount: 67,
|
||||
},
|
||||
]);
|
||||
|
||||
const getCategoryType = (category: string) => {
|
||||
const typeMap: Record<string, any> = {
|
||||
问候: 'success',
|
||||
感谢: 'primary',
|
||||
支持: 'warning',
|
||||
道歉: 'danger',
|
||||
结束: 'info',
|
||||
介绍: '',
|
||||
};
|
||||
return typeMap[category] || '';
|
||||
};
|
||||
|
||||
const handleReplyClick = (reply: Reply) => {
|
||||
ElMessage.success(`使用快捷回复: ${reply.title}`);
|
||||
};
|
||||
|
||||
const handleCopy = (reply: Reply) => {
|
||||
navigator.clipboard.writeText(reply.content);
|
||||
ElMessage.success('已复制到剪贴板');
|
||||
};
|
||||
|
||||
const handleEdit = (reply: Reply) => {
|
||||
ElMessage.info(`编辑回复: ${reply.title}`);
|
||||
};
|
||||
|
||||
const handleDelete = (reply: Reply) => {
|
||||
ElMessage.warning(`删除回复: ${reply.title}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.reply-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.reply-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
border: 1px solid #e5e7eb;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
transform: translateY(-2px);
|
||||
border-color: #3b82f6;
|
||||
}
|
||||
}
|
||||
|
||||
.reply-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.reply-category {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.reply-usage {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.reply-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
|
||||
.reply-content {
|
||||
font-size: 14px;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
margin: 0 0 16px 0;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.reply-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #f3f4f6;
|
||||
}
|
||||
|
||||
.reply-tags {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.reply-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
207
src/views/home/components/Sidebar.vue
Normal file
207
src/views/home/components/Sidebar.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<el-button class="new-chat-btn" @click="handleNewChat">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
新增对话
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div v-if="historyList.length" class="history-section">
|
||||
<div class="history-title">历史对话</div>
|
||||
<div class="history-list">
|
||||
<div
|
||||
v-for="item in historyList"
|
||||
:key="item.id"
|
||||
class="history-item"
|
||||
:class="{ active: activeHistoryId === item.id }"
|
||||
@click="handleSelectHistory(item.id)"
|
||||
>
|
||||
<div class="history-main">
|
||||
<div class="history-name">{{ item.title }}</div>
|
||||
<div class="history-time">{{ item.time }}</div>
|
||||
</div>
|
||||
<el-button text class="delete-btn" @click.stop="handleDeleteHistory(item.id)">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Plus, Delete } from '@element-plus/icons-vue';
|
||||
|
||||
interface HistoryItem {
|
||||
id: number;
|
||||
title: string;
|
||||
time: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
activeMenu: string;
|
||||
activeHistoryId: number;
|
||||
historyList: HistoryItem[];
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'menu-change', key: string): void;
|
||||
(e: 'new-chat'): void;
|
||||
(e: 'select-history', id: number): void;
|
||||
(e: 'delete-history', id: number): void;
|
||||
}
|
||||
|
||||
defineProps<Props>();
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const handleNewChat = () => {
|
||||
emit('new-chat');
|
||||
};
|
||||
|
||||
const handleSelectHistory = (id: number) => {
|
||||
emit('select-history', id);
|
||||
};
|
||||
|
||||
const handleDeleteHistory = (id: number) => {
|
||||
emit('delete-history', id);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sidebar {
|
||||
width: 252px;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 251, 255, 0.92) 100%);
|
||||
border-right: 1px solid #e7edf7;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
box-shadow: 8px 0 30px rgba(15, 23, 42, 0.06);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
padding: 18px 16px 14px;
|
||||
border-bottom: 1px solid #e9eef7;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.new-chat-btn {
|
||||
margin-top: 0;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(59, 130, 246, 0.28);
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.2px;
|
||||
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
color: #ffffff;
|
||||
border-color: rgba(59, 130, 246, 0.4);
|
||||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
|
||||
box-shadow: 0 6px 16px rgba(37, 99, 235, 0.32);
|
||||
}
|
||||
}
|
||||
|
||||
.history-section {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 8px;
|
||||
min-height: 0;
|
||||
background: linear-gradient(180deg, rgba(249, 251, 255, 0.5) 0%, rgba(249, 251, 255, 0.9) 100%);
|
||||
}
|
||||
|
||||
.history-title {
|
||||
padding: 12px 12px 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
}
|
||||
|
||||
.history-list {
|
||||
flex: 1;
|
||||
padding: 0 8px 10px;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.history-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 10px 10px;
|
||||
margin-bottom: 6px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
|
||||
&:hover {
|
||||
border-color: #bfdbfe;
|
||||
background: linear-gradient(135deg, rgba(239, 246, 255, 0.9) 0%, rgba(219, 234, 254, 0.7) 100%);
|
||||
transform: translateX(2px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: #3b82f6;
|
||||
background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 100%);
|
||||
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
opacity: 0;
|
||||
color: #94a3b8;
|
||||
transition: all 0.2s ease;
|
||||
padding: 4px;
|
||||
|
||||
&:hover {
|
||||
color: #ef4444;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .delete-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.history-main {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.history-name {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #1e293b;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.history-time {
|
||||
font-size: 11px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,62 +1,61 @@
|
||||
<template>
|
||||
<el-dialog :title="isEdit ? '编辑数据集' : '新增数据集'" v-model="isShowDialog" width="600px" :close-on-click-modal="false" @close="onCancel">
|
||||
<el-form ref="formRef" :model="ruleForm" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="数据集名称" prop="name">
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数据集类型" prop="type">
|
||||
<el-select v-model="ruleForm.type" placeholder="请选择类型" clearable style="width: 100%">
|
||||
<el-option label="文本" value="text" />
|
||||
<el-option label="问答" value="qa" />
|
||||
<el-option label="表格" value="table" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="向量模型" prop="embeddingModel">
|
||||
<el-select v-model="ruleForm.embeddingModel" placeholder="请选择向量模型" clearable style="width: 100%">
|
||||
<el-option label="text-embedding-ada-002" value="text-embedding-ada-002" />
|
||||
<el-option label="text-embedding-3-small" value="text-embedding-3-small" />
|
||||
<el-option label="text-embedding-3-large" value="text-embedding-3-large" />
|
||||
<el-option label="bge-large-zh" value="bge-large-zh" />
|
||||
<el-option label="m3e-base" value="m3e-base" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" v-if="isEdit">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="文档数量">
|
||||
<el-input :value="ruleForm.documentCount" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="字符数量">
|
||||
<el-input :value="ruleForm.charCount" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="onCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog :title="isEdit ? '编辑数据集' : '新增数据集'" v-model="isShowDialog" width="600px" :close-on-click-modal="false" @close="onCancel">
|
||||
<el-form ref="formRef" :model="ruleForm" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="数据集名称" prop="name">
|
||||
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数据集类型" prop="datasetType">
|
||||
<el-select v-model="ruleForm.datasetType" placeholder="请选择类型" clearable style="width: 100%">
|
||||
<el-option label="文本" :value="1" />
|
||||
<el-option label="视频" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="向量模型" prop="embeddingModel">
|
||||
<el-select v-model="ruleForm.embeddingModel" placeholder="请选择向量模型" clearable style="width: 100%">
|
||||
<el-option label="text-embedding-ada-002" value="text-embedding-ada-002" />
|
||||
<el-option label="text-embedding-3-small" value="text-embedding-3-small" />
|
||||
<el-option label="text-embedding-3-large" value="text-embedding-3-large" />
|
||||
<el-option label="bge-large-zh" value="bge-large-zh" />
|
||||
<el-option label="m3e-base" value="m3e-base" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" v-if="isEdit">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="文档数量">
|
||||
<el-input :value="ruleForm.documentCount" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="字符数量">
|
||||
<el-input :value="ruleForm.charCount" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="onCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -86,7 +85,7 @@ const submitLoading = ref(false);
|
||||
const ruleForm = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
type: 'text',
|
||||
datasetType: 1 as number,
|
||||
description: '',
|
||||
embeddingModel: 'text-embedding-ada-002',
|
||||
documentCount: 0,
|
||||
@@ -96,7 +95,7 @@ const ruleForm = reactive({
|
||||
// 表单验证规则
|
||||
const rules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
||||
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
||||
embeddingModel: [{ required: true, message: '请选择向量模型', trigger: 'change' }],
|
||||
});
|
||||
|
||||
@@ -104,7 +103,7 @@ const rules = reactive<FormRules>({
|
||||
const resetForm = () => {
|
||||
ruleForm.id = '';
|
||||
ruleForm.name = '';
|
||||
ruleForm.type = 'text';
|
||||
ruleForm.datasetType = 1;
|
||||
ruleForm.description = '';
|
||||
ruleForm.embeddingModel = 'text-embedding-ada-002';
|
||||
ruleForm.documentCount = 0;
|
||||
@@ -122,7 +121,7 @@ const openDialog = async (row?: any) => {
|
||||
const data = res.data || row;
|
||||
ruleForm.id = data.id || '';
|
||||
ruleForm.name = data.name || '';
|
||||
ruleForm.type = data.type || 'text';
|
||||
ruleForm.datasetType = data.datasetType || 1;
|
||||
ruleForm.description = data.description || '';
|
||||
ruleForm.embeddingModel = data.embeddingModel || 'text-embedding-ada-002';
|
||||
ruleForm.documentCount = data.documentCount || 0;
|
||||
@@ -132,7 +131,7 @@ const openDialog = async (row?: any) => {
|
||||
// 使用传入的row数据
|
||||
ruleForm.id = row.id || '';
|
||||
ruleForm.name = row.name || '';
|
||||
ruleForm.type = row.type || 'text';
|
||||
ruleForm.datasetType = row.datasetType || 1;
|
||||
ruleForm.description = row.description || '';
|
||||
ruleForm.embeddingModel = row.embeddingModel || 'text-embedding-ada-002';
|
||||
ruleForm.documentCount = row.documentCount || 0;
|
||||
@@ -161,7 +160,7 @@ const onSubmit = async () => {
|
||||
const data = {
|
||||
id: ruleForm.id || undefined,
|
||||
name: ruleForm.name,
|
||||
type: ruleForm.type,
|
||||
datasetType: ruleForm.datasetType,
|
||||
description: ruleForm.description,
|
||||
embeddingModel: ruleForm.embeddingModel,
|
||||
status: 'enable',
|
||||
|
||||
@@ -1,107 +1,106 @@
|
||||
<template>
|
||||
<div class="knowledge-knowledge-page">
|
||||
<div class="knowledge-knowledge-container">
|
||||
<el-card shadow="hover">
|
||||
<div class="knowledge-knowledge-search mb15">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="数据集名称">
|
||||
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据集类型">
|
||||
<el-select size="default" v-model="tableData.param.type" placeholder="请选择类型" clearable style="width: 150px">
|
||||
<el-option label="文本" value="text" />
|
||||
<el-option label="问答" value="qa" />
|
||||
<el-option label="表格" value="table" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
|
||||
<el-option label="启用" value="enable" />
|
||||
<el-option label="禁用" value="disable" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="default" type="primary" @click="getknowledgeList">
|
||||
<el-icon><ele-Search /></el-icon>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button size="default" @click="onResetQuery">
|
||||
<el-icon><ele-Refresh /></el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
|
||||
<el-icon><ele-Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading" border>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="类型" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="getTypeTagType(scope.row.type)">{{ getTypeText(scope.row.type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
|
||||
<el-table-column prop="charCount" label="字符数" width="120" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatCharCount(scope.row.charCount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="status" label="状态" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.statusEnabled"
|
||||
inline-prompt
|
||||
active-text="启"
|
||||
inactive-text="停"
|
||||
@change="onStatusChange(scope.row)"
|
||||
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="updatedAt" label="更新时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="200" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="onEdit(scope.row)" v-auth="'api/v1/knowledge/knowledge/update'">编辑</el-button>
|
||||
<el-button size="small" text type="success" @click="onManageDocuments(scope.row)">文档</el-button>
|
||||
<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-auth="'api/v1/knowledge/knowledge/delete'">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<div class="mt15" style="text-align: right">
|
||||
<el-pagination
|
||||
v-model:current-page="tableData.param.pageNum"
|
||||
v-model:page-size="tableData.param.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="tableData.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="onSizeChange"
|
||||
@current-change="onCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="knowledge-knowledge-page">
|
||||
<div class="knowledge-knowledge-container">
|
||||
<el-card shadow="hover">
|
||||
<div class="knowledge-knowledge-search mb15">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="数据集名称">
|
||||
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据集类型">
|
||||
<el-select size="default" v-model="tableData.param.datasetType" placeholder="请选择类型" clearable style="width: 150px">
|
||||
<el-option label="文本" :value="1" />
|
||||
<el-option label="视频" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
|
||||
<el-option label="启用" value="enable" />
|
||||
<el-option label="禁用" value="disable" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="default" type="primary" @click="getknowledgeList">
|
||||
<el-icon><ele-Search /></el-icon>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button size="default" @click="onResetQuery">
|
||||
<el-icon><ele-Refresh /></el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
|
||||
<el-icon><ele-Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading" border>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="datasetType" label="类型" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="getTypeTagType(scope.row.datasetType)">{{ getTypeText(scope.row.datasetType) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
|
||||
<el-table-column prop="charCount" label="字符数" width="120" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatCharCount(scope.row.charCount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="status" label="状态" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.statusEnabled"
|
||||
inline-prompt
|
||||
active-text="启"
|
||||
inactive-text="停"
|
||||
@change="onStatusChange(scope.row)"
|
||||
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="updatedAt" label="更新时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="200" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button size="small" text type="primary" @click="onEdit(scope.row)" v-auth="'api/v1/knowledge/knowledge/update'">编辑</el-button>
|
||||
<el-button size="small" text type="success" @click="onManageDocuments(scope.row)">文档</el-button>
|
||||
<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-auth="'api/v1/knowledge/knowledge/delete'">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<div class="mt15" style="text-align: right">
|
||||
<el-pagination
|
||||
v-model:current-page="tableData.param.pageNum"
|
||||
v-model:page-size="tableData.param.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="tableData.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="onSizeChange"
|
||||
@current-change="onCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
|
||||
</div>
|
||||
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'knowledgeknowledge',
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
@@ -117,7 +116,7 @@ const tableData = reactive({
|
||||
loading: false,
|
||||
param: {
|
||||
keyword: '',
|
||||
type: '',
|
||||
datasetType: undefined as number | undefined,
|
||||
status: undefined as string | undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -148,30 +147,26 @@ const getknowledgeList = async () => {
|
||||
};
|
||||
|
||||
// 获取类型标签类型
|
||||
const getTypeTagType = (type: string) => {
|
||||
switch (type) {
|
||||
case 'text':
|
||||
const getTypeTagType = (datasetType: number) => {
|
||||
switch (datasetType) {
|
||||
case 1:
|
||||
return 'primary';
|
||||
case 'qa':
|
||||
case 2:
|
||||
return 'success';
|
||||
case 'table':
|
||||
return 'warning';
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
};
|
||||
|
||||
// 获取类型文本
|
||||
const getTypeText = (type: string) => {
|
||||
switch (type) {
|
||||
case 'text':
|
||||
const getTypeText = (datasetType: number) => {
|
||||
switch (datasetType) {
|
||||
case 1:
|
||||
return '文本';
|
||||
case 'qa':
|
||||
return '问答';
|
||||
case 'table':
|
||||
return '表格';
|
||||
case 2:
|
||||
return '视频';
|
||||
default:
|
||||
return type;
|
||||
return String(datasetType);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -187,7 +182,7 @@ const formatCharCount = (count: number) => {
|
||||
// 重置查询
|
||||
const onResetQuery = () => {
|
||||
tableData.param.keyword = '';
|
||||
tableData.param.type = '';
|
||||
tableData.param.datasetType = undefined;
|
||||
tableData.param.status = undefined;
|
||||
tableData.param.pageNum = 1;
|
||||
getknowledgeList();
|
||||
@@ -261,9 +256,9 @@ const onCurrentChange = (page: number) => {
|
||||
onMounted(() => {
|
||||
getknowledgeList();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<style scoped lang="scss">
|
||||
.knowledge-knowledge-page {
|
||||
padding: 15px;
|
||||
.knowledge-knowledge-container {
|
||||
@@ -274,4 +269,4 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<template #default="{ row }">
|
||||
<el-button text size="small" v-debounce @click="onPreviewFile(row)">预览</el-button>
|
||||
<el-button v-if="row.vectorStatus === 1" text size="small" type="primary" v-debounce @click="onGenerateVector(row)"
|
||||
>生成向量</el-button
|
||||
>生成向量</el-button
|
||||
>
|
||||
<el-button v-else text size="small" type="primary" v-debounce @click="onViewTaskList(row)">查看任务</el-button>
|
||||
<el-button text size="small" type="danger" v-debounce @click="onDeleteFile(row)">删除</el-button>
|
||||
@@ -233,6 +233,12 @@
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="knowledgeForm.name" placeholder="请输入知识库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据集类型" prop="datasetType">
|
||||
<el-select v-model="knowledgeForm.datasetType" placeholder="请选择类型" clearable style="width: 100%">
|
||||
<el-option label="文本" :value="1" />
|
||||
<el-option label="视频" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="knowledgeForm.description" type="textarea" :rows="3" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
@@ -469,10 +475,12 @@ const knowledgeFormRef = ref<FormInstance>();
|
||||
const knowledgeForm = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
datasetType: undefined as number | undefined,
|
||||
description: '',
|
||||
});
|
||||
const knowledgeRules = reactive<FormRules>({
|
||||
name: [{ required: true, message: '请输入知识库名称', trigger: 'blur' }],
|
||||
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
||||
});
|
||||
|
||||
// 文件列表(含OSS上传结果)
|
||||
@@ -555,6 +563,7 @@ const getknowledgeList = async () => {
|
||||
const response = await listknowledges({
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
datasetType: 1,
|
||||
});
|
||||
knowledgeList.value = response.data.list || [];
|
||||
} catch (_error) {
|
||||
@@ -576,6 +585,7 @@ const onSelectknowledge = (item: any) => {
|
||||
const onAddknowledge = () => {
|
||||
knowledgeForm.id = '';
|
||||
knowledgeForm.name = '';
|
||||
knowledgeForm.datasetType = undefined;
|
||||
knowledgeForm.description = '';
|
||||
showknowledgeDialog.value = true;
|
||||
};
|
||||
@@ -594,6 +604,7 @@ const onCardContextMenu = (event: MouseEvent, item: any) => {
|
||||
const onRenameknowledge = (item: any) => {
|
||||
knowledgeForm.id = item.id;
|
||||
knowledgeForm.name = item.name;
|
||||
knowledgeForm.datasetType = item.datasetType;
|
||||
knowledgeForm.description = item.description || '';
|
||||
showknowledgeDialog.value = true;
|
||||
};
|
||||
@@ -634,14 +645,17 @@ const onSaveknowledge = async () => {
|
||||
await updateknowledge({
|
||||
id: knowledgeForm.id,
|
||||
name: knowledgeForm.name,
|
||||
datasetType: knowledgeForm.datasetType,
|
||||
description: knowledgeForm.description,
|
||||
});
|
||||
} else {
|
||||
// 创建知识库
|
||||
await createknowledge({
|
||||
const params = {
|
||||
name: knowledgeForm.name,
|
||||
datasetType: knowledgeForm.datasetType as number,
|
||||
description: knowledgeForm.description,
|
||||
});
|
||||
};
|
||||
await createknowledge(params);
|
||||
}
|
||||
|
||||
ElMessage.success(knowledgeForm.id ? '保存成功' : '创建成功');
|
||||
@@ -988,7 +1002,7 @@ const onSaveModelConfig = async () => {
|
||||
// 构建请求数据,只传递接口需要的字段
|
||||
const data = {
|
||||
modelType: selectedModelType.value,
|
||||
configType: selectedConfigType.value,
|
||||
configType: selectedConfigType,
|
||||
modelName: modelFormData.value.modelName,
|
||||
modelDesc: modelFormData.value.modelDesc,
|
||||
configContent: {} as Record<string, any>,
|
||||
|
||||
@@ -1093,6 +1093,12 @@ const availableParentParams = computed(() => {
|
||||
// 如果是判断节点,跳过不添加其字段
|
||||
if (isJudge) return;
|
||||
|
||||
// 首先添加节点的整体输出选项
|
||||
params.push({
|
||||
label: `${parentNodeName}【整体输出】`,
|
||||
value: `\${${parentId}}`,
|
||||
});
|
||||
|
||||
// 只添加可引用字段(HTTP节点仅允许结果返回结构;其他节点维持原逻辑)
|
||||
if (parentProps.formConfig && Array.isArray(parentProps.formConfig)) {
|
||||
if (nodeCode === 'http') {
|
||||
@@ -1184,15 +1190,24 @@ const workflowDsl = computed(() => ({
|
||||
const rawValue = item.value;
|
||||
let normalizedValue: any = rawValue;
|
||||
if (typeof rawValue === 'string') {
|
||||
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
|
||||
if (matched) {
|
||||
normalizedValue = {
|
||||
field: matched[2],
|
||||
nodeId: matched[1],
|
||||
quoteOutput: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
|
||||
if (matched) {
|
||||
normalizedValue = {
|
||||
field: matched[2],
|
||||
nodeId: matched[1],
|
||||
quoteOutput: false,
|
||||
};
|
||||
} else {
|
||||
const nodeOutputMatched = rawValue.match(/^\$\{([^}]+)\}$/);
|
||||
if (nodeOutputMatched) {
|
||||
normalizedValue = {
|
||||
field: 'nodeOutputResult',
|
||||
nodeId: nodeOutputMatched[1],
|
||||
quoteOutput: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const normalizedItem: any = {
|
||||
key: realKey,
|
||||
@@ -2550,6 +2565,14 @@ const getHttpBodyData = (field: string) => {
|
||||
rawItem.fieldConstraint = rawItem.fieldConstraint && typeof rawItem.fieldConstraint === 'object' ? rawItem.fieldConstraint : {};
|
||||
} else {
|
||||
rawItem.showInForm = false;
|
||||
// 回显上级节点引用:对象结构转回选择器可识别的字符串
|
||||
if (rawItem.value && typeof rawItem.value === 'object' && !Array.isArray(rawItem.value)) {
|
||||
const refNodeId = String(rawItem.value.nodeId || '').trim();
|
||||
const refField = String(rawItem.value.field || '').trim();
|
||||
if (refNodeId) {
|
||||
rawItem.value = refField === 'nodeOutputResult' ? `\${${refNodeId}}` : refField ? `\${${refNodeId}.${refField}}` : rawItem.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
@@ -2736,7 +2759,7 @@ const confirmHttpBodyConfig = () => {
|
||||
const rawValue = item?.value;
|
||||
let normalizedValue: any = rawValue;
|
||||
|
||||
// 如果 value 选择了上级参数(形如 ${nodeId.field}),转成对象结构传给后端
|
||||
// 如果 value 选择了上级参数(形如 ${nodeId.field})或上级节点整体输出(形如 ${nodeId}),转成对象结构传给后端
|
||||
if (typeof rawValue === 'string') {
|
||||
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
|
||||
if (matched) {
|
||||
@@ -2745,6 +2768,15 @@ const confirmHttpBodyConfig = () => {
|
||||
nodeId: matched[1],
|
||||
quoteOutput: false,
|
||||
};
|
||||
} else {
|
||||
const nodeOutputMatched = rawValue.match(/^\$\{([^}]+)\}$/);
|
||||
if (nodeOutputMatched) {
|
||||
normalizedValue = {
|
||||
field: 'nodeOutputResult',
|
||||
nodeId: nodeOutputMatched[1],
|
||||
quoteOutput: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3856,15 +3888,11 @@ const deleteSelectedElement = async () => {
|
||||
if (affectedNodeNames.length > 0) {
|
||||
const previewNames = affectedNodeNames.slice(0, 8);
|
||||
const overflowText = affectedNodeNames.length > 8 ? `\n...等 ${affectedNodeNames.length} 个节点` : '';
|
||||
await ElMessageBox.confirm(
|
||||
`删除该节点将清理以下下级节点中的引用:\n${previewNames.join('、')}${overflowText}`,
|
||||
'删除确认',
|
||||
{
|
||||
confirmButtonText: '继续删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
);
|
||||
await ElMessageBox.confirm(`删除该节点将清理以下下级节点中的引用:\n${previewNames.join('、')}${overflowText}`, '删除确认', {
|
||||
confirmButtonText: '继续删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
|
||||
affectedCount = cleanupReferencesToNode(cur.id);
|
||||
@@ -3878,7 +3906,7 @@ const deleteSelectedElement = async () => {
|
||||
if (error === 'cancel') return;
|
||||
ElMessage.error('删除失败');
|
||||
}
|
||||
};// 从后端 DSL 恢复工作流
|
||||
}; // 从后端 DSL 恢复工作流
|
||||
const loadWorkflowFromDsl = (dsl: any) => {
|
||||
const lf = logicFlowInstance.value;
|
||||
if (!lf || !dsl) return;
|
||||
@@ -5627,6 +5655,3 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
314
src/views/settings/promptManager/index.vue
Normal file
314
src/views/settings/promptManager/index.vue
Normal file
@@ -0,0 +1,314 @@
|
||||
<template>
|
||||
<div class="prompt-manager-container">
|
||||
<!-- 搜索栏 -->
|
||||
<div class="search-bar">
|
||||
<el-input v-model="searchQuery" placeholder="搜索提示词内容..." prefix-icon="Search" style="width: 300px" clearable @input="handleSearch" />
|
||||
<el-button type="primary" @click="showCreateDialog = true">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增提示词
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<div class="table-container">
|
||||
<el-table :data="filteredList" v-loading="loading" border style="width: 100%">
|
||||
<el-table-column prop="nodeType" label="节点类型" width="150" />
|
||||
<el-table-column prop="prompt" label="提示词内容" min-width="350">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip v-if="row.prompt.length > 80" content="hover" :enterable="false">
|
||||
<template #content>
|
||||
<div style="max-width: 400px; white-space: pre-wrap">{{ row.prompt }}</div>
|
||||
</template>
|
||||
<span>{{ row.prompt.slice(0, 80) }}...</span>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ row.prompt }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sourceType" label="来源" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.sourceType === 0">自定义</el-tag>
|
||||
<el-tag v-else-if="row.sourceType === 1" type="success">公共</el-tag>
|
||||
<el-tag v-else type="info">{{ row.sourceType }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="creator" label="创建者" width="120" />
|
||||
<el-table-column prop="createdAt" label="创建时间" width="170" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link size="small" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button type="danger" link size="small" @click="handleDeleteConfirm(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.current"
|
||||
v-model:page-size="pagination.size"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, ->, prev, pager, next, jumper"
|
||||
:total="pagination.total"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<el-dialog v-model="showCreateDialog" :title="isEdit ? '编辑提示词' : '新增提示词'" width="600px" :close-on-click-modal="false">
|
||||
<el-form ref="createFormRef" :model="createForm" label-width="100px">
|
||||
<el-form-item label="节点类型" required>
|
||||
<el-select v-model="createForm.nodeType" placeholder="请选择节点类型" style="width: 100%" clearable v-loading="nodeLibraryLoading">
|
||||
<el-option v-for="option in nodeOptions" :key="option.value" :label="option.label" :value="option.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提示词内容" required>
|
||||
<el-input v-model="createForm.prompt" type="textarea" :rows="8" placeholder="请输入提示词内容..." clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="cancelCreate">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmitCreate" :loading="submitLoading">
|
||||
{{ isEdit ? '保存修改' : '确 定' }}
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 删除确认弹窗 -->
|
||||
<el-dialog v-model="showDeleteDialog" title="确认删除" width="400px" :close-on-click-modal="false">
|
||||
<div>确定要删除这个提示词吗?</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="showDeleteDialog = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleDelete" :loading="deleteLoading">确 定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="promptManager">
|
||||
import { ref, reactive, computed, onMounted } from 'vue';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { getNodeLibraryList, getMyPromptList, createPrompt, updatePrompt, deletePrompt, type NodeLibraryGroup, type NodeLibraryNode, type PromptItem } from '/@/api/settings/promptManager/index';
|
||||
|
||||
const searchQuery = ref('');
|
||||
const loading = ref(false);
|
||||
const list = ref<PromptItem[]>([]);
|
||||
const showCreateDialog = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const submitLoading = ref(false);
|
||||
const createFormRef = ref();
|
||||
const editId = ref<number | string | null>(null);
|
||||
const nodeLibraryLoading = ref(false);
|
||||
const nodeLibraryGroups = ref<NodeLibraryGroup[]>([]);
|
||||
const showDeleteDialog = ref(false);
|
||||
const deleteLoading = ref(false);
|
||||
const deleteId = ref<number | string | null>(null);
|
||||
const nodeOptions = computed(() => {
|
||||
const options: Array<{ label: string; value: string }> = [];
|
||||
nodeLibraryGroups.value.forEach((group: NodeLibraryGroup) => {
|
||||
group.items.forEach((item: NodeLibraryNode) => {
|
||||
// 只显示支持提示词配置的节点
|
||||
if (item.promptOption) {
|
||||
options.push({
|
||||
label: item.nodeName,
|
||||
value: item.nodeCode,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return options;
|
||||
});
|
||||
|
||||
const createForm = reactive({
|
||||
nodeType: '',
|
||||
prompt: '',
|
||||
sourceType: 0 as number,
|
||||
});
|
||||
|
||||
// 加载节点库
|
||||
const loadNodeLibrary = async () => {
|
||||
nodeLibraryLoading.value = true;
|
||||
try {
|
||||
const res = await getNodeLibraryList();
|
||||
if (res && res.data && res.data.groups) {
|
||||
nodeLibraryGroups.value = res.data.groups;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载节点库失败:', e);
|
||||
ElMessage.error('加载节点类型失败');
|
||||
} finally {
|
||||
nodeLibraryLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const pagination = reactive({
|
||||
current: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 过滤后的列表
|
||||
const filteredList = computed(() => {
|
||||
if (!searchQuery.value) {
|
||||
return list.value;
|
||||
}
|
||||
const query = searchQuery.value.toLowerCase();
|
||||
return list.value.filter(
|
||||
(item) => item.nodeType.toLowerCase().includes(query) || item.prompt.toLowerCase().includes(query) || item.creator?.toLowerCase().includes(query)
|
||||
);
|
||||
});
|
||||
|
||||
// 加载列表
|
||||
const loadList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getMyPromptList({
|
||||
pageNum: pagination.current,
|
||||
pageSize: pagination.size,
|
||||
});
|
||||
if (res && res.data && res.data.list) {
|
||||
list.value = res.data.list;
|
||||
pagination.total = res.data.total || 0;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
ElMessage.error('加载失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
pagination.current = 1;
|
||||
loadList();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const handleSubmitCreate = async () => {
|
||||
// 验证
|
||||
if (!createForm.nodeType?.trim()) {
|
||||
ElMessage.warning('请选择节点类型');
|
||||
return;
|
||||
}
|
||||
if (!createForm.prompt?.trim()) {
|
||||
ElMessage.warning('请输入提示词内容');
|
||||
return;
|
||||
}
|
||||
|
||||
submitLoading.value = true;
|
||||
try {
|
||||
if (isEdit.value && editId.value) {
|
||||
await updatePrompt({
|
||||
id: editId.value,
|
||||
...createForm,
|
||||
});
|
||||
ElMessage.success('修改成功');
|
||||
} else {
|
||||
await createPrompt({
|
||||
nodeType: createForm.nodeType.trim(),
|
||||
prompt: createForm.prompt.trim(),
|
||||
sourceType: createForm.sourceType,
|
||||
});
|
||||
ElMessage.success('创建成功');
|
||||
}
|
||||
showCreateDialog.value = false;
|
||||
cancelCreate();
|
||||
loadList();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
ElMessage.error('操作失败');
|
||||
} finally {
|
||||
submitLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: PromptItem) => {
|
||||
isEdit.value = true;
|
||||
editId.value = row.id;
|
||||
createForm.nodeType = row.nodeType || '';
|
||||
createForm.prompt = row.prompt || '';
|
||||
createForm.sourceType = row.sourceType || 0;
|
||||
showCreateDialog.value = true;
|
||||
};
|
||||
|
||||
// 打开删除确认弹窗
|
||||
const handleDeleteConfirm = (id: number | string) => {
|
||||
deleteId.value = id;
|
||||
showDeleteDialog.value = true;
|
||||
};
|
||||
|
||||
// 删除
|
||||
const handleDelete = async () => {
|
||||
if (!deleteId.value) return;
|
||||
deleteLoading.value = true;
|
||||
try {
|
||||
await deletePrompt(deleteId.value);
|
||||
ElMessage.success('删除成功');
|
||||
showDeleteDialog.value = false;
|
||||
loadList();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
ElMessage.error('删除失败');
|
||||
} finally {
|
||||
deleteLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 取消
|
||||
const cancelCreate = () => {
|
||||
createFormRef.value?.resetFields();
|
||||
isEdit.value = false;
|
||||
editId.value = null;
|
||||
createForm.nodeType = '';
|
||||
createForm.prompt = '';
|
||||
createForm.sourceType = 0;
|
||||
};
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (size: number) => {
|
||||
pagination.size = size;
|
||||
pagination.current = 1;
|
||||
loadList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (current: number) => {
|
||||
pagination.current = current;
|
||||
loadList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadNodeLibrary();
|
||||
loadList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.prompt-manager-container {
|
||||
padding: 16px;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
.pagination-container {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
279
src/views/settings/workflow/component/InputSourceManager.vue
Normal file
279
src/views/settings/workflow/component/InputSourceManager.vue
Normal file
@@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<div class="input-source-manager">
|
||||
<el-divider content-position="left">上级参数引用</el-divider>
|
||||
|
||||
<!-- 已引用的参数列表 -->
|
||||
<div v-if="currentInputSource && currentInputSource.length > 0" class="input-source-list">
|
||||
<div v-for="(sourceNode, index) in currentInputSource" :key="index" class="input-source-item">
|
||||
<div class="input-source-header">
|
||||
<span class="input-source-node-name">{{ getNodeName(sourceNode.nodeId) }}</span>
|
||||
</div>
|
||||
<div v-if="sourceNode.field && sourceNode.field.length > 0" class="input-source-fields">
|
||||
<div v-for="fieldName in sourceNode.field" :key="fieldName" class="field-tag">
|
||||
<el-tag size="small">{{ fieldName }}</el-tag>
|
||||
<el-button type="danger" link size="small" @click="emit('removeField', sourceNode.nodeId, fieldName)">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-source-output">
|
||||
<el-switch
|
||||
:model-value="sourceNode.quoteOutput === true"
|
||||
@change="(val: boolean) => emit('toggleOutput', sourceNode.nodeId, val)"
|
||||
size="small"
|
||||
active-text="引入输出"
|
||||
inactive-text=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 显示所有上级节点的输出引用选项 -->
|
||||
<div v-if="availableParentNodes.length > 0" class="parent-nodes-output">
|
||||
<div class="parent-nodes-title">上级节点输出</div>
|
||||
<div v-for="parentNode in availableParentNodes" :key="parentNode.id" class="parent-node-output-item">
|
||||
<span class="parent-node-name">{{ parentNode.name }}</span>
|
||||
<el-switch
|
||||
:model-value="isNodeOutputQuoted(parentNode.id)"
|
||||
@change="(val: boolean) => emit('toggleOutput', parentNode.id, val)"
|
||||
size="small"
|
||||
active-text="引入输出"
|
||||
inactive-text=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 选择参数下拉框 -->
|
||||
<el-form-item label="选择参数">
|
||||
<el-select :model-value="selectedParam" @update:model-value="handleParamSelect" placeholder="选择上级节点的参数" class="w100">
|
||||
<el-option v-for="param in availableParams" :key="param.value" :label="param.label" :value="param.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import type { Node } from '@vue-flow/core';
|
||||
|
||||
interface NodeData {
|
||||
label?: string;
|
||||
nodeCode?: string;
|
||||
inputSource?: Array<{ nodeId: string; field: string[]; quoteOutput?: boolean }> | null;
|
||||
formConfig?: any[];
|
||||
modelConfig?: any;
|
||||
skillName?: string;
|
||||
}
|
||||
|
||||
interface ParentNode {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface ParamOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
selectedNode: Node<NodeData, any, string> | null;
|
||||
nodes: Node<NodeData, any, string>[];
|
||||
edges: any[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'removeField', nodeId: string, fieldName: string): void;
|
||||
(e: 'toggleOutput', nodeId: string, enabled: boolean): void;
|
||||
(e: 'addParam', paramValue: string): void;
|
||||
}>();
|
||||
|
||||
const selectedParam = ref('');
|
||||
|
||||
// 当前节点的 inputSource
|
||||
const currentInputSource = computed(() => {
|
||||
if (!props.selectedNode?.data?.inputSource) return [];
|
||||
return props.selectedNode.data.inputSource.filter((item) => item.field && item.field.length > 0);
|
||||
});
|
||||
|
||||
// 获取节点名称
|
||||
const getNodeName = (nodeId: string) => {
|
||||
const node = props.nodes.find((n) => n.id === nodeId);
|
||||
return node?.data?.label || nodeId;
|
||||
};
|
||||
|
||||
// 获取所有上级节点(用于显示输出引用选项)
|
||||
const availableParentNodes = computed(() => {
|
||||
if (!props.selectedNode?.data) return [];
|
||||
|
||||
// 获取已经引用了字段的节点ID列表
|
||||
const inputSource = props.selectedNode.data.inputSource;
|
||||
const nodesWithFields = new Set<string>();
|
||||
if (Array.isArray(inputSource)) {
|
||||
inputSource.forEach((item) => {
|
||||
if (item.field && item.field.length > 0) {
|
||||
nodesWithFields.add(item.nodeId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 递归查找所有上级节点
|
||||
const findAllParentNodes = (nodeId: string, visited = new Set<string>()): string[] => {
|
||||
if (visited.has(nodeId)) return [];
|
||||
visited.add(nodeId);
|
||||
|
||||
const incomingEdges = props.edges.filter((e) => e.target === nodeId);
|
||||
const parentIds: string[] = [];
|
||||
|
||||
incomingEdges.forEach((edge) => {
|
||||
parentIds.push(edge.source);
|
||||
parentIds.push(...findAllParentNodes(edge.source, visited));
|
||||
});
|
||||
|
||||
return parentIds;
|
||||
};
|
||||
|
||||
const allParentIds = findAllParentNodes(props.selectedNode.id);
|
||||
const parentNodes = allParentIds
|
||||
.map((parentId) => {
|
||||
const parentNode = props.nodes.find((n) => n.id === parentId);
|
||||
if (!parentNode?.data) return null;
|
||||
|
||||
const nodeCode = String(parentNode.data.nodeCode || '').toLowerCase();
|
||||
const isJudge = ['判断', 'judge', 'condition', 'if', 'branch', 'gateway'].some((k) => nodeCode.includes(k));
|
||||
const isStart = nodeCode === '__start__';
|
||||
|
||||
if (isJudge || isStart || nodesWithFields.has(parentId)) return null;
|
||||
|
||||
return {
|
||||
id: parentId,
|
||||
name: parentNode.data.label || parentId,
|
||||
};
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
return parentNodes as ParentNode[];
|
||||
});
|
||||
|
||||
// 检查节点输出是否被引用
|
||||
const isNodeOutputQuoted = (nodeId: string): boolean => {
|
||||
if (!props.selectedNode?.data) return false;
|
||||
const inputSource = props.selectedNode.data.inputSource;
|
||||
if (!Array.isArray(inputSource)) return false;
|
||||
|
||||
const node = inputSource.find((item) => item.nodeId === nodeId);
|
||||
return node?.quoteOutput === true;
|
||||
};
|
||||
|
||||
// 获取可用的参数选项
|
||||
const availableParams = computed(() => {
|
||||
if (!props.selectedNode) return [];
|
||||
|
||||
const params: ParamOption[] = [];
|
||||
const visited = new Set<string>();
|
||||
|
||||
const findParents = (nodeId: string) => {
|
||||
if (visited.has(nodeId)) return;
|
||||
visited.add(nodeId);
|
||||
|
||||
props.edges
|
||||
.filter((e) => e.target === nodeId)
|
||||
.forEach((edge) => {
|
||||
const parent = props.nodes.find((n) => n.id === edge.source);
|
||||
if (parent?.data && parent.data.nodeCode !== '__start__' && parent.data.nodeCode !== 'judge') {
|
||||
params.push({
|
||||
label: `${parent.data.label}.output`,
|
||||
value: `\${${parent.id}.output}`,
|
||||
});
|
||||
}
|
||||
findParents(edge.source);
|
||||
});
|
||||
};
|
||||
|
||||
findParents(props.selectedNode.id);
|
||||
return params;
|
||||
});
|
||||
|
||||
const handleParamSelect = (value: string) => {
|
||||
if (!value) return;
|
||||
emit('addParam', value);
|
||||
selectedParam.value = '';
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.input-source-manager {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.input-source-list {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.input-source-item {
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.input-source-header {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.input-source-node-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.input-source-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.field-tag {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 8px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.input-source-output {
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.parent-nodes-output {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.parent-nodes-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.parent-node-output-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 6px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.parent-node-name {
|
||||
font-size: 13px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.w100 {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
263
src/views/settings/workflow/component/NodeConfigPanel.vue
Normal file
263
src/views/settings/workflow/component/NodeConfigPanel.vue
Normal file
@@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<div class="config-panel">
|
||||
<h3>节点配置</h3>
|
||||
<div v-if="selectedNode">
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="节点名称">
|
||||
<el-input :model-value="selectedNode.data?.label" @update:model-value="updateNodeLabel" />
|
||||
</el-form-item>
|
||||
<el-form-item label="节点类型">
|
||||
<el-tag>{{ selectedNode.data?.nodeCode }}</el-tag>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 模型选择 -->
|
||||
<el-form-item v-if="nodeConfig?.modelConfig && nodeConfig.modelConfig.length > 0" label="选择模型">
|
||||
<el-button type="primary" @click="emit('openModelSelector')" style="width: 100%">选择模型</el-button>
|
||||
<div v-if="selectedNode.data?.modelConfig?.modelName" class="selected-tag">
|
||||
<el-tag type="success" size="large" closable @close="emit('removeModel')">
|
||||
{{ selectedNode.data.modelConfig.modelName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 技能选择 -->
|
||||
<el-form-item v-if="nodeConfig?.skillOption" label="选择技能">
|
||||
<el-button type="primary" @click="emit('openSkillSelector')" style="width: 100%">选择技能</el-button>
|
||||
<div v-if="selectedNode.data?.skillName" class="selected-tag">
|
||||
<el-tag type="success" size="large" closable @close="emit('removeSkill')">
|
||||
{{ selectedNode.data.skillName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 动态表单字段 -->
|
||||
<template v-if="nodeConfig?.formConfig && nodeConfig.formConfig.length > 0">
|
||||
<el-divider content-position="left">节点参数</el-divider>
|
||||
<el-form-item v-for="field in nodeConfig.formConfig" :key="field.field" :label="field.label" :required="field.required">
|
||||
<el-input
|
||||
v-if="field.type === 'input' || field.type === 'string'"
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
:placeholder="field.required ? '必填' : '选填'"
|
||||
/>
|
||||
<el-input-number
|
||||
v-else-if="field.type === 'number' || field.type === 'inputNumber'"
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
class="w100"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="field.type === 'textarea'"
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:placeholder="field.required ? '必填' : '选填'"
|
||||
/>
|
||||
<el-switch
|
||||
v-else-if="field.type === 'switch'"
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
/>
|
||||
<el-select
|
||||
v-else-if="field.type === 'select' && field.options"
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
:placeholder="field.required ? '必填' : '选填'"
|
||||
class="w100"
|
||||
>
|
||||
<el-option v-for="opt in field.options" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
<el-input
|
||||
v-else
|
||||
:model-value="getFieldValue(field.field)"
|
||||
@update:model-value="updateFieldValue(field.field, $event)"
|
||||
:placeholder="field.required ? '必填' : '选填'"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
|
||||
<!-- 上级参数管理 -->
|
||||
<InputSourceManager
|
||||
v-if="selectedNode.data?.nodeCode !== '__start__'"
|
||||
:selected-node="selectedNode"
|
||||
:nodes="allNodes"
|
||||
:edges="allEdges"
|
||||
@remove-field="(nodeId: string, fieldName: string) => emit('removeField', nodeId, fieldName)"
|
||||
@toggle-output="(nodeId: string, enabled: boolean) => emit('toggleOutput', nodeId, enabled)"
|
||||
@add-param="(paramValue: string) => emit('addParamByValue', paramValue)"
|
||||
/>
|
||||
</div>
|
||||
<el-empty v-else description="请选择一个节点" :image-size="100" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Node } from '@vue-flow/core';
|
||||
import InputSourceManager from './InputSourceManager.vue';
|
||||
|
||||
interface NodeData {
|
||||
label?: string;
|
||||
nodeCode?: string;
|
||||
inputSource?: Array<{ nodeId: string; field: string[]; quoteOutput?: boolean }> | null;
|
||||
formConfig?: any[];
|
||||
modelConfig?: any;
|
||||
skillName?: string;
|
||||
}
|
||||
|
||||
interface ParamRef {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface NodeConfig {
|
||||
formConfig: any[];
|
||||
modelConfig: any[];
|
||||
skillOption: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
selectedNode: Node<NodeData, any, string> | null;
|
||||
availableParams: ParamRef[];
|
||||
nodeConfig: NodeConfig | null;
|
||||
allNodes: Node<NodeData, any, string>[];
|
||||
allEdges: any[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:selectedNode', node: Node<NodeData, any, string>): void;
|
||||
(e: 'addParam', param: ParamRef): void;
|
||||
(e: 'openModelSelector'): void;
|
||||
(e: 'removeModel'): void;
|
||||
(e: 'openSkillSelector'): void;
|
||||
(e: 'removeSkill'): void;
|
||||
(e: 'removeField', nodeId: string, fieldName: string): void;
|
||||
(e: 'toggleOutput', nodeId: string, enabled: boolean): void;
|
||||
(e: 'addParamByValue', paramValue: string): void;
|
||||
}>();
|
||||
|
||||
const updateNodeLabel = (newLabel: string) => {
|
||||
if (!props.selectedNode?.data) return;
|
||||
const updatedNode = {
|
||||
...props.selectedNode,
|
||||
data: {
|
||||
...props.selectedNode.data,
|
||||
label: newLabel,
|
||||
},
|
||||
};
|
||||
emit('update:selectedNode', updatedNode);
|
||||
};
|
||||
|
||||
const getFieldValue = (fieldName: string) => {
|
||||
if (!props.selectedNode?.data?.formConfig) return '';
|
||||
const field = props.selectedNode.data.formConfig.find((f: any) => f.field === fieldName);
|
||||
return field?.value ?? '';
|
||||
};
|
||||
|
||||
const updateFieldValue = (fieldName: string, value: any) => {
|
||||
if (!props.selectedNode?.data) return;
|
||||
|
||||
const formConfig = props.selectedNode.data.formConfig || [];
|
||||
const existingIndex = formConfig.findIndex((f: any) => f.field === fieldName);
|
||||
|
||||
let updatedFormConfig;
|
||||
if (existingIndex >= 0) {
|
||||
updatedFormConfig = [...formConfig];
|
||||
updatedFormConfig[existingIndex] = { ...updatedFormConfig[existingIndex], value };
|
||||
} else {
|
||||
const fieldDef = props.nodeConfig?.formConfig.find((f) => f.field === fieldName);
|
||||
if (fieldDef) {
|
||||
updatedFormConfig = [...formConfig, { ...fieldDef, value }];
|
||||
} else {
|
||||
updatedFormConfig = formConfig;
|
||||
}
|
||||
}
|
||||
|
||||
const updatedNode = {
|
||||
...props.selectedNode,
|
||||
data: {
|
||||
...props.selectedNode.data,
|
||||
formConfig: updatedFormConfig,
|
||||
},
|
||||
};
|
||||
emit('update:selectedNode', updatedNode);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.config-panel {
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
padding: 16px;
|
||||
overflow-y: auto;
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
|
||||
border: 1px solid #e6eaf0;
|
||||
|
||||
h3 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #334155;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
:deep(.el-form) {
|
||||
.el-form-item {
|
||||
margin-bottom: 14px;
|
||||
|
||||
.el-form-item__label {
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
margin-bottom: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.el-input__wrapper {
|
||||
border-radius: 6px;
|
||||
box-shadow: none;
|
||||
border: 1px solid #dbe3ee;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #b8c4d6;
|
||||
}
|
||||
|
||||
&.is-focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.param-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 8px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #cbd5e1;
|
||||
background: #f1f5f9;
|
||||
}
|
||||
}
|
||||
|
||||
.selected-tag {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.w100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-empty) {
|
||||
padding: 32px 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
164
src/views/settings/workflow/component/NodeLibraryPanel.vue
Normal file
164
src/views/settings/workflow/component/NodeLibraryPanel.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="node-library-panel" :class="{ collapsed: collapsed }">
|
||||
<div class="node-library-header">
|
||||
<span>节点库</span>
|
||||
<el-button class="collapse-btn" text circle @click="emit('update:collapsed', !collapsed)">
|
||||
<el-icon>
|
||||
<ArrowRightBold v-if="collapsed" />
|
||||
<ArrowLeftBold v-else />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="!collapsed" class="node-library-content">
|
||||
<el-empty v-if="nodeLibraryGroups.length === 0" description="暂无节点" :image-size="40" />
|
||||
<div v-else class="node-library-groups">
|
||||
<div v-for="group in nodeLibraryGroups" :key="group.group" class="node-group">
|
||||
<div class="node-group-title">{{ group.label }}</div>
|
||||
<div class="node-group-items">
|
||||
<el-button
|
||||
v-for="item in group.items"
|
||||
:key="item.nodeCode"
|
||||
text
|
||||
class="node-item"
|
||||
@click="emit('addNode', item.nodeCode, item.nodeName)"
|
||||
>
|
||||
{{ item.nodeName }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';
|
||||
import type { NodeLibraryGroup } from '/@/api/settings/creation';
|
||||
|
||||
defineProps<{
|
||||
nodeLibraryGroups: NodeLibraryGroup[];
|
||||
collapsed: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:collapsed', value: boolean): void;
|
||||
(e: 'addNode', nodeCode: string, nodeName: string): void;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.node-library-panel {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
z-index: 10;
|
||||
background: #fff;
|
||||
border: 1px solid #d8e0eb;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
|
||||
width: 132px;
|
||||
max-height: calc(100% - 20px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: width 0.18s ease;
|
||||
|
||||
&.collapsed {
|
||||
width: 40px;
|
||||
|
||||
.node-library-header {
|
||||
padding: 8px;
|
||||
border-bottom: none;
|
||||
|
||||
> span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.node-library-content {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.node-library-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid #e7ecf3;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
background: #f8fafc;
|
||||
|
||||
.collapse-btn {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 1px solid #cfd8e6;
|
||||
color: #64748b;
|
||||
}
|
||||
}
|
||||
|
||||
.node-library-content {
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
max-height: 480px;
|
||||
}
|
||||
|
||||
.node-library-groups {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.node-group {
|
||||
.node-group-title {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #64748b;
|
||||
margin-bottom: 8px;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid #e7ecf3;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.node-group-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.node-item {
|
||||
justify-content: flex-start !important;
|
||||
width: 100%;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
color: #475569;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
background: transparent;
|
||||
border: none;
|
||||
transition: all 0.15s ease;
|
||||
text-align: left !important;
|
||||
min-height: 34px;
|
||||
height: auto !important;
|
||||
display: block !important;
|
||||
|
||||
&:hover {
|
||||
background: #f1f5f9;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
:deep(.el-button__inner) {
|
||||
width: 100%;
|
||||
padding: 8px !important;
|
||||
margin: 0 !important;
|
||||
text-align: left !important;
|
||||
justify-content: flex-start !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
40
src/views/settings/workflow/component/SaveWorkflowDialog.vue
Normal file
40
src/views/settings/workflow/component/SaveWorkflowDialog.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="500px" :close-on-click-modal="false">
|
||||
<el-form :model="saveForm" label-position="top">
|
||||
<el-form-item label="工作流名称" required>
|
||||
<el-input v-model="saveForm.flowName" placeholder="请输入工作流名称" maxlength="50" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作流描述">
|
||||
<el-input v-model="saveForm.description" type="textarea" :rows="4" placeholder="请输入工作流描述(选填)" maxlength="200" show-word-limit />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="emit('confirm')">{{ confirmText }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean;
|
||||
saveForm: { flowName: string; description: string };
|
||||
currentEditingWorkflowId: string | null;
|
||||
saving: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: boolean): void;
|
||||
(e: 'confirm'): void;
|
||||
}>();
|
||||
|
||||
const dialogVisible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value: boolean) => emit('update:modelValue', value),
|
||||
});
|
||||
|
||||
const dialogTitle = computed(() => (props.currentEditingWorkflowId ? '编辑工作流' : '保存工作流'));
|
||||
const confirmText = computed(() => (props.currentEditingWorkflowId ? '确定更新' : '确定保存'));
|
||||
</script>
|
||||
190
src/views/settings/workflow/component/WorkflowListPanel.vue
Normal file
190
src/views/settings/workflow/component/WorkflowListPanel.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div class="workflow-list-panel">
|
||||
<div class="panel-header">
|
||||
<el-tabs v-model="activeTab" class="workflow-tabs">
|
||||
<el-tab-pane label="我的工作流" name="user"></el-tab-pane>
|
||||
<el-tab-pane label="模板工作流" name="template"></el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="workflow-list-content" v-loading="loading">
|
||||
<el-empty v-if="currentList.length === 0" description="暂无工作流" :image-size="60" />
|
||||
<div v-else class="workflow-items">
|
||||
<div
|
||||
v-for="workflow in currentList"
|
||||
:key="workflow.id"
|
||||
class="workflow-item"
|
||||
:class="{ active: currentEditingId === workflow.id }"
|
||||
@click="emit('edit', workflow)"
|
||||
>
|
||||
<div class="workflow-item-content">
|
||||
<div class="workflow-item-name">{{ workflow.flowName || workflow.flowTemplateName || '未命名工作流' }}</div>
|
||||
<div class="workflow-item-desc">{{ workflow.description || '暂无描述' }}</div>
|
||||
</div>
|
||||
<div class="workflow-item-actions">
|
||||
<el-button type="primary" link size="small" @click.stop="emit('edit', workflow)">编辑</el-button>
|
||||
<el-button type="danger" link size="small" @click.stop="emit('delete', workflow)">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import type { WorkflowItem } from '/@/api/settings/creation';
|
||||
|
||||
const props = defineProps<{
|
||||
userWorkflowList: WorkflowItem[];
|
||||
templateWorkflowList: WorkflowItem[];
|
||||
currentEditingId: string | null;
|
||||
loading: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'edit', workflow: WorkflowItem): void;
|
||||
(e: 'delete', workflow: WorkflowItem): void;
|
||||
(e: 'create'): void;
|
||||
}>();
|
||||
|
||||
const activeTab = ref<'user' | 'template'>('user');
|
||||
|
||||
const currentList = computed(() => {
|
||||
return activeTab.value === 'user' ? props.userWorkflowList : props.templateWorkflowList;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.workflow-list-panel {
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
padding: 16px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
|
||||
border: 1px solid #e6eaf0;
|
||||
|
||||
.panel-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 14px;
|
||||
|
||||
:deep(.el-button) {
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.workflow-tabs {
|
||||
flex: 1;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
padding: 0 16px;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
|
||||
&.is-active {
|
||||
color: #3b82f6;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-tabs__active-bar) {
|
||||
background-color: #3b82f6;
|
||||
}
|
||||
}
|
||||
|
||||
.workflow-list-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background: rgba(102, 126, 234, 0.05);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.workflow-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.workflow-item {
|
||||
padding: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
background: #fff;
|
||||
|
||||
&:hover {
|
||||
border-color: #c5d2e6;
|
||||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: #3b82f6;
|
||||
background: #eff6ff;
|
||||
}
|
||||
}
|
||||
|
||||
.workflow-item-content {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.workflow-item-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin-bottom: 4px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.workflow-item-desc {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.workflow-item-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
|
||||
:deep(.el-button) {
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
font-size: 12px;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1064
src/views/settings/workflow/index.vue
Normal file
1064
src/views/settings/workflow/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDCTCCAfGgAwIBAgIUYPm47gB5/E1nGqiCSdyGLE6hK/MwDQYJKoZIhvcNAQEL
|
||||
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI2MDUyMDA1NDg1MVoXDTM2MDUx
|
||||
NzA1NDg1MVowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
|
||||
AAOCAQ8AMIIBCgKCAQEAiXk9CZgDdtkAmIfw/3iFo2G9WA7ctgBSjG+0MKe2rp0P
|
||||
WfnpiBAG3jiFLT+TUvcleXEUdukcN2wlr8e3jaHSv6cEI4OKk5OsBk8FY1QnenD1
|
||||
NeYUovKppMklAG9PfzOtFY0upu3bQtG5+P2j0+9s3+Rci2YHVX/T5L8TnKGqUkDw
|
||||
gEY//KtUSmvmCbqNOw5t13GYTUvEsfrDVicwlWgyvPCbmPtLRKF4gTBGvGh0Q8x6
|
||||
PqWRU80/MU0NXHYcdPYtHljjRU5tLq/YxTqYvGKCd1fLq2BlG54mjUU9wfDvyh/N
|
||||
YGkX+Pw8JWbvka5V9K1sqxM4j3wqPJPiIJbrAf561wIDAQABo1MwUTAdBgNVHQ4E
|
||||
FgQUOws9qwD3ykeP1cFoVkAh3w3MzIIwHwYDVR0jBBgwFoAUOws9qwD3ykeP1cFo
|
||||
VkAh3w3MzIIwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAJytt
|
||||
ZQj8E+PohYYKzNjWj+NwoldKpNeCTr73zIwTB20C1GdusxU5AiGC6spT3hKk2rMU
|
||||
CRIlhpfFbTQX5GIxOsWAQ2ru1zmN0L0mA25TZ6c/D6RZPVMjTTolLKIghdQkAyFm
|
||||
Twclb7yTILu7HEj4xf2xiVT98ZxZMGfiwCm3PlB7ur9CqMBRF4IDxQ+s60oHKdcj
|
||||
tHmUv/g/t4y9aIaqyqQuPeERU7BWdDLEyE4WrPijw2cif6IhaJeK29iqIHqb3vo8
|
||||
YMj9Ef/83Csks8idDz5r0rVa2MB5hf11FBe+gLVAh8vOiXMaBnoiTBPhiGfIZTBl
|
||||
uJjuVzPObt0drvdZwQ==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCJeT0JmAN22QCY
|
||||
h/D/eIWjYb1YDty2AFKMb7Qwp7aunQ9Z+emIEAbeOIUtP5NS9yV5cRR26Rw3bCWv
|
||||
x7eNodK/pwQjg4qTk6wGTwVjVCd6cPU15hSi8qmkySUAb09/M60VjS6m7dtC0bn4
|
||||
/aPT72zf5FyLZgdVf9PkvxOcoapSQPCARj/8q1RKa+YJuo07Dm3XcZhNS8Sx+sNW
|
||||
JzCVaDK88JuY+0tEoXiBMEa8aHRDzHo+pZFTzT8xTQ1cdhx09i0eWONFTm0ur9jF
|
||||
Opi8YoJ3V8urYGUbniaNRT3B8O/KH81gaRf4/DwlZu+RrlX0rWyrEziPfCo8k+Ig
|
||||
lusB/nrXAgMBAAECggEAAgqvqp0/++vv6OOM1AQVe8kBVbXp8u1hDmv2mGcQqZBN
|
||||
wJCT1Yod0i26/fW6/Y2XnhZwesdVFci62K5rQxkL46i1peufedr+7r+J6cfTFGYU
|
||||
oOlY/msaT4NGDieNbXqPeIujO/9sdRoCCRoC6PYYUoNfEWe7qJs5nBsxPiW7YCwK
|
||||
Kg2h932FOvI+7AxllV0vUsHfPYbirH4jl0b00lKoeUdQh8pB4hTUMgksCEWnJwr3
|
||||
4YQz3iqwIbWTy3/c1EULV0x5QmP0CsadSLSddo8gOB8k4aJStfNGzTuuLsrsETSU
|
||||
NifQGsP1YzHMieKT3BqwoZeoIqXng0O1dGyPsaZMKQKBgQC9i/Ii6HL2UdpgDTq4
|
||||
m+jFyEaSAXkOoIivhjRmoZhpBUNRJsIpm4xQPjYiO68USl5XkxxHqiMqF1SDxLAW
|
||||
9WViuytkDM/uawSY8F/f3PoKKPdJCM1NE34oEWOp7Hs+HWOhhtJqUxDzKJLwfASV
|
||||
blwLGJ5XlEbMuf/D79hW2kez7wKBgQC5q6r0C4c+ayfAn7RftopIu8VCquNNwdGh
|
||||
qQfMuGKDXPZfwBYDlZWHXwbH8CrlNHfPpZCRH8fmPK5T6zCX6XrrccJ+GMcFFwuw
|
||||
vOMkVYQOfL8Y6WfnzRpC2hZPIbNxSJbt8PEzZleCWuyvl2RULj+XCEDBRrSnzkRf
|
||||
UW3bBUYfmQKBgQCmQXYlgFY2EB3HWlNDUh2ePckIkBoq5kx+CO01iFAy7dbZ+3Eb
|
||||
JcCxMaAx7r/mwER39CU+BtHJPaV33rHFsYE4VIv+ue44Zc4mh9DQfvciqkQc34eU
|
||||
L6DcbERK644+MXEOYT92211mqxQXs/AhUieR5AofL4PaVtssddgAdn2mKQKBgQCd
|
||||
08Rc8RPExlejUN6F4ehIjXzP/+16YoAtGD8uEaqEGdjAacsMvvG9gdSEzq3X6jLS
|
||||
St3JzycgmoJhiXHkIC9BxpDamXtL41wnn1jBwQOhQP88UOPnUhy5qSL/nxkm+dp6
|
||||
Zq7Rz3QhteKuHFXHjQy2+Of6o3zbi+Xo1JI6dJA4OQKBgGK/L+ImW1930CwBEvR/
|
||||
pLwCvwEhP5EXd7SJtCuubPiKsnNS3Bb8FqiKYlOX3ANz2z2EoBdJQvTGhca6ORhU
|
||||
Gr5s61dui2np1aH2NduxmeJx2ywhkaNfz/j1mbESh2CjqkO5qvN96z6EST5KlDqP
|
||||
zFDSFLd4cs0yRko2tulKVAAU
|
||||
-----END PRIVATE KEY-----
|
||||
62
ssl/scs1779764972146_redpowerfuture.com_server.crt
Normal file
62
ssl/scs1779764972146_redpowerfuture.com_server.crt
Normal file
@@ -0,0 +1,62 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIGCTCCBPGgAwIBAgIQCbk8r0AqeDTQmt8tQBlLTzANBgkqhkiG9w0BAQsFADBu
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
|
||||
RFYgVExTIENBIC0gRzIwHhcNMjYwNTI2MDAwMDAwWhcNMjYwODI1MjM1OTU5WjAd
|
||||
MRswGQYDVQQDExJyZWRwb3dlcmZ1dHVyZS5jb20wggEiMA0GCSqGSIb3DQEBAQUA
|
||||
A4IBDwAwggEKAoIBAQDaa/u6fK1eth80Wnn3Er/tzwUrWNT+yKeXd6Hus35C4lwD
|
||||
euIv9nG+45iggLVDJvD/NCT4LlNUbZ/57MEIagpanOfbVKW+xSaYpFbhLoy+hwWU
|
||||
pK4mDyv0MtzSTiFbZKU+LepiJwyjwnnbyR71Xik0nbxb68lBC/wYlMtuvn8oIfdB
|
||||
j/xDxhsel4rt+gekSmmycFS4Jh5HVky8ofUVN3SbdFWgCkyPM68zc+hw2MqRHjfK
|
||||
sgjx2b/WaLfSi8qBJF1oqLlqX9BsNzCP7tTBUH1o5VTPtgP1ICkp+JTlQp3WM6ua
|
||||
sljXnTUdAHdvytCFd/mSFFQ1HeaYceFtRcNYxf7PAgMBAAGjggLyMIIC7jAfBgNV
|
||||
HSMEGDAWgBR435GQX+7erPbFdevVTFVT7yRKtjAdBgNVHQ4EFgQUhlGg1Q8rQeyT
|
||||
BZpspLDJcVphGZ0wNQYDVR0RBC4wLIIScmVkcG93ZXJmdXR1cmUuY29tghZ3d3cu
|
||||
cmVkcG93ZXJmdXR1cmUuY29tMD4GA1UdIAQ3MDUwMwYGZ4EMAQIBMCkwJwYIKwYB
|
||||
BQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAOBgNVHQ8BAf8EBAMC
|
||||
BaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEF
|
||||
BQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEoGCCsGAQUFBzAChj5odHRw
|
||||
Oi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRW5jcnlwdGlvbkV2ZXJ5d2hlcmVEVlRM
|
||||
U0NBLUcyLmNydDAMBgNVHRMBAf8EAjAAMIIBfQYKKwYBBAHWeQIEAgSCAW0EggFp
|
||||
AWcAdgDCMX5XRRmjRe5/ON6ykEHrx8IhWiK/f9W1rXaa2Q5SzQAAAZ5iSF5XAAAE
|
||||
AwBHMEUCIAr6FBJHXrAg0wjPX0PStK+tIhQ/94KkU4PBR4WsTxRtAiEArtDnplV+
|
||||
9hbjOs0j2cRlxGuE8QtM/pmlIV+jtkZwgsQAdQDXbX0Q0af1d8LH6V/XAL/5gskz
|
||||
WmXh0LMBcxfAyMVpdwAAAZ5iSF4uAAAEAwBGMEQCICS/ddUJMlaxmEvuk4My/cZ4
|
||||
TNmensyP/TbnJSpyoYdIAiBy0v/DYnFCYU+Y6KXUUJj8kTJlBR87sloDEIS/HdOl
|
||||
7AB2AJROQ4f67MHvgfMZJCaoGGUBx9NfOAIBP3JnfVU3LhnYAAABnmJIXmUAAAQD
|
||||
AEcwRQIgDZdQPgnfZBGbDfk01SeAbliEycANB1pkcLzIdc+L15UCIQCzk0mg544c
|
||||
efvISO7fIbjx0tEnUrItMLTsYXrxpzMwZzANBgkqhkiG9w0BAQsFAAOCAQEApYQk
|
||||
hfTsipwGQ/RDgmnbBrX54qHAU+u4ru3vKmQfWLt306fMw3njxWjxll0vv59Tst/v
|
||||
idaA57NocaYmPV3IvaWn2XNUwZt+YIO9xmbgJ8nRse3uGrfmu8oRrulWr0xu2Gh6
|
||||
FleqmGgYDP+2IGfupX+T5rhiAgH37ViG2Y8EmFZVKwG1JSzQPdUFwgiLQhU98PjR
|
||||
V0iZeUkHna2HhqLEMIYpQ2cC61AS4qkx2aQ9osg4wsYInqLuaCIbEYv5UEgLU5lR
|
||||
IyMfIKw8TSl9LekeksjIgKAVZQk6gYGqoQHR9HP0UIbFcu5yJ6Oar+IFBHPgWFCb
|
||||
D5k/3VsDjhXUNgLs1A==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEqjCCA5KgAwIBAgIQDeD/te5iy2EQn2CMnO1e0zANBgkqhkiG9w0BAQsFADBh
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH
|
||||
MjAeFw0xNzExMjcxMjQ2NDBaFw0yNzExMjcxMjQ2NDBaMG4xCzAJBgNVBAYTAlVT
|
||||
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
|
||||
b20xLTArBgNVBAMTJEVuY3J5cHRpb24gRXZlcnl3aGVyZSBEViBUTFMgQ0EgLSBH
|
||||
MjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO8Uf46i/nr7pkgTDqnE
|
||||
eSIfCFqvPnUq3aF1tMJ5hh9MnO6Lmt5UdHfBGwC9Si+XjK12cjZgxObsL6Rg1njv
|
||||
NhAMJ4JunN0JGGRJGSevbJsA3sc68nbPQzuKp5Jc8vpryp2mts38pSCXorPR+sch
|
||||
QisKA7OSQ1MjcFN0d7tbrceWFNbzgL2csJVQeogOBGSe/KZEIZw6gXLKeFe7mupn
|
||||
NYJROi2iC11+HuF79iAttMc32Cv6UOxixY/3ZV+LzpLnklFq98XORgwkIJL1HuvP
|
||||
ha8yvb+W6JislZJL+HLFtidoxmI7Qm3ZyIV66W533DsGFimFJkz3y0GeHWuSVMbI
|
||||
lfsCAwEAAaOCAU8wggFLMB0GA1UdDgQWBBR435GQX+7erPbFdevVTFVT7yRKtjAf
|
||||
BgNVHSMEGDAWgBROIlQgGJXm427mD/r6uRLtBhePOTAOBgNVHQ8BAf8EBAMCAYYw
|
||||
HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8C
|
||||
AQAwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdp
|
||||
Y2VydC5jb20wQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQu
|
||||
Y29tL0RpZ2lDZXJ0R2xvYmFsUm9vdEcyLmNybDBMBgNVHSAERTBDMDcGCWCGSAGG
|
||||
/WwBAjAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20vQ1BT
|
||||
MAgGBmeBDAECATANBgkqhkiG9w0BAQsFAAOCAQEAoBs1eCLKakLtVRPFRjBIJ9LJ
|
||||
L0s8ZWum8U8/1TMVkQMBn+CPb5xnCD0GSA6L/V0ZFrMNqBirrr5B241OesECvxIi
|
||||
98bZ90h9+q/X5eMyOD35f8YTaEMpdnQCnawIwiHx06/0BfiTj+b/XQih+mqt3ZXe
|
||||
xNCJqKexdiB2IWGSKcgahPacWkk/BAQFisKIFYEqHzV974S3FAz/8LIfD58xnsEN
|
||||
GfzyIDkH3JrwYZ8caPTf6ZX9M1GrISN8HnWTtdNCH2xEajRa/h9ZBXjUyFKQrGk2
|
||||
n2hcLrfZSbynEC/pSw/ET7H5nWwckjmAJ1l9fcnbqkU/pf6uMQmnfl0JQjJNSg==
|
||||
-----END CERTIFICATE-----
|
||||
27
ssl/scs1779764972146_redpowerfuture.com_server.key
Normal file
27
ssl/scs1779764972146_redpowerfuture.com_server.key
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEogIBAAKCAQEA2mv7unytXrYfNFp59xK/7c8FK1jU/sinl3eh7rN+QuJcA3ri
|
||||
L/ZxvuOYoIC1Qybw/zQk+C5TVG2f+ezBCGoKWpzn21SlvsUmmKRW4S6MvocFlKSu
|
||||
Jg8r9DLc0k4hW2SlPi3qYicMo8J528ke9V4pNJ28W+vJQQv8GJTLbr5/KCH3QY/8
|
||||
Q8YbHpeK7foHpEppsnBUuCYeR1ZMvKH1FTd0m3RVoApMjzOvM3PocNjKkR43yrII
|
||||
8dm/1mi30ovKgSRdaKi5al/QbDcwj+7UwVB9aOVUz7YD9SApKfiU5UKd1jOrmrJY
|
||||
1501HQB3b8rQhXf5khRUNR3mmHHhbUXDWMX+zwIDAQABAoIBAEFYoxQ07s1yIT3R
|
||||
f8HKiz9De2FvjzG2qGUpdnnqm3C5NhwYbIk66ubYQrZqK1Cu2tUPLaxOd8G/lmf4
|
||||
S/wPdY+Md9Vnqrq7UwPBzvhJq/Pog2PoLO3YBidl/CizFUm5f7JtnDzHQAHSUhDO
|
||||
SAPSqvNB6bN6hFiAlGhqQ76bIYHIsfAmeUK6d0fmvBHWY57436VhiEMExtX29GTw
|
||||
dKgePgBE+1R0Lwykwx2/CANPs+zs67b/tqDTDjk7Kxecz7LrrGoRbmOFRx2p27FQ
|
||||
5lftdJqHAP5sBdVPlA+97z5cJBlU02yUb2mLfOIsCerpxl+FLdqQcQ1v16I6kXsP
|
||||
B+dn37ECgYEA+jLgs3x13pzIWMLBPKGYXLDjZ8nnKza/XSoiRizEmt7tbq6An4Cw
|
||||
ClYKuHd+/hygf04UsPn2sJ+zSvfmxYFnUr6YuzmVNN3S1igcBwz98kQkOSBsPqvT
|
||||
YB1KgDF079QS99ixfB4idOG5NdCuXGn7PZbYgt610K/dcRZ2PcCEyQcCgYEA33x8
|
||||
KZjL5RoFxdTBW9DuNRYcvDJFI+L8WsFE8nEtotpf3kSs3rMy+HxLVIcmFBnrc+N+
|
||||
pwt9La8ZHvLM7eshXSi2kAUbyPe7kPrOdcv7ye7L84sVBNCw7J/d3jn+Zpvepvhc
|
||||
E1B0LYhQJYzwv97pH/98epQI8QXWQsAeQN9TEfkCgYEAqrIba1j2cbI1XZlBjMQS
|
||||
1uo3u4+cD3eCh2U/jPDuEVsWUfTr++YoNGUPW1rrYSLWvQPgSf2/uDC8eeE3qHfo
|
||||
riMqwFFA4piUR1eGB6ltd+PVcsQUFY3U4DYbpeoYBaeCaWWFcVB94ZA+c+CzlIkZ
|
||||
x6Mqg9693GqfgY/5i5fU//ECfydIuoqVUUH0UQ91VofNMhIi0OpD6+NjAvjxAC2d
|
||||
t2fo+vEXIUwEM/F558Pz/b2K0NiOJLU4T8i3/rJx+5PWwQafIXgvbbLl2RKjA6ex
|
||||
M5FLaI5m5Er0ZCUz9MwbZZyjyX+QKJ88hS97xprTK36OsGvvfPIPE4NKg184ZhkB
|
||||
KJkCgYEAjk5kR/HyHLcLVrkrc0iQHCHYpuYRP4zCL1FdTmsXy0toAdvlA2D4nB/L
|
||||
2Sdh+0Tj9qRF2zdCA4LBlpEbEPY5oYzDuurJ1lw9LV2gek+yi0wTsbPR+3pMwQ/2
|
||||
M4JfUkjAldpKBIx/V68vA2mc226wlInpBkRMz6V63GIMjj8WDz8=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
Reference in New Issue
Block a user