Compare commits
57 Commits
7fe519df28
...
feature/wo
| Author | SHA1 | Date | |
|---|---|---|---|
| ffab3be854 | |||
| f85107be6d | |||
| 27f35a5679 | |||
| 2ede6f4ba0 | |||
| 195d219f91 | |||
| 536ad8386c | |||
| 10519e7500 | |||
| 79d0a2a9fe | |||
| 20bf8138a8 | |||
| 1c0e966b7a | |||
| 57ca523b5a | |||
| f72508aa83 | |||
| 61577be41f | |||
| 1baef251ab | |||
| b25a1457af | |||
| 85845b0d38 | |||
| 075bf22add | |||
| 52340fcd94 | |||
| 10d6ce2b0d | |||
| 58d5713ec1 | |||
| cb6c881365 | |||
| ffaf04982a | |||
| 28d81d86bd | |||
| 0b958a0ebb | |||
| c13e01c902 | |||
| c8ad78ab44 | |||
| 04a8912307 | |||
| 495fde42ca | |||
| 5363613a7d | |||
| fc54bcd3d6 | |||
| 4a8bc3cb7a | |||
| 367cd98018 | |||
| ee8ba0a5d9 | |||
| 56e1517743 | |||
| eea5874dbf | |||
| 6ef063ac09 | |||
| c37710af3d | |||
| c52d31c16e | |||
| 48a4636a81 | |||
| 9c03013c44 | |||
| 05a0e35891 | |||
| 937d1e9373 | |||
| af3f0678b8 | |||
| 68d9767bd8 | |||
| ccbf6de863 | |||
| d3a315525e | |||
| 38e15ed562 | |||
| c7fba23e3b | |||
| b60583008b | |||
| 542895c61c | |||
| 538e153473 | |||
| 78d1fd93c8 | |||
| 032f258912 | |||
| 9bd4a44ab6 | |||
| 4174c424fc | |||
| 0d946c050e | |||
| 95f020047d |
@@ -38,10 +38,10 @@ module.exports = {
|
|||||||
'@typescript-eslint/no-redeclare': 'error',
|
'@typescript-eslint/no-redeclare': 'error',
|
||||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
||||||
'@typescript-eslint/no-unused-vars': [
|
'@typescript-eslint/no-unused-vars': [
|
||||||
'error',
|
'warn',
|
||||||
{
|
{
|
||||||
argsIgnorePattern: '^_',
|
argsIgnorePattern: '^_',
|
||||||
varsIgnorePattern: '^_',
|
varsIgnorePattern: '^_|props|watch',
|
||||||
caughtErrorsIgnorePattern: '^_',
|
caughtErrorsIgnorePattern: '^_',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -64,6 +64,11 @@ module.exports = {
|
|||||||
'vue/no-parsing-error': 'off',
|
'vue/no-parsing-error': 'off',
|
||||||
'vue/no-deprecated-v-on-native-modifier': 'off',
|
'vue/no-deprecated-v-on-native-modifier': 'off',
|
||||||
'vue/multi-word-component-names': '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-useless-escape': 'off',
|
||||||
'no-sparse-arrays': 'off',
|
'no-sparse-arrays': 'off',
|
||||||
'no-prototype-builtins': 'off',
|
'no-prototype-builtins': 'off',
|
||||||
@@ -77,8 +82,8 @@ module.exports = {
|
|||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
'no-v-model-argument': 'off',
|
'no-v-model-argument': 'off',
|
||||||
'no-case-declarations': 'off',
|
'no-case-declarations': 'off',
|
||||||
'no-console': 'error',
|
'no-console': 'off',
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'warn',
|
||||||
'no-redeclare': 'off',
|
'no-redeclare': 'off',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,68 +1,18 @@
|
|||||||
name: 全局K3s部署
|
name: 部署 admin-ui 到 K3s
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
# ========== 核心修复:替换为具体Ubuntu版本,解决运行期匹配问题 ==========
|
runs-on: ubuntu-latest
|
||||||
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:
|
steps:
|
||||||
# ========== 核心:新增国内Git代理,彻底解决GitHub拉取慢 ==========
|
- name: 拉取代码
|
||||||
- name: 配置国内GitHub代理加速
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 部署到 K3s
|
||||||
run: |
|
run: |
|
||||||
# 全局Git代理:所有GitHub请求走国内镜像站
|
kubectl apply -f k8s/
|
||||||
git config --global url."https://ghproxy.com/https://github.com/".insteadOf "https://github.com/"
|
kubectl rollout restart deployment admin-ui
|
||||||
# 可选:替换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
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,8 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
/dist
|
||||||
|
|
||||||
|
# Vue language service / accidental transpile artifacts
|
||||||
src/**/*.vue.js
|
src/**/*.vue.js
|
||||||
|
|
||||||
|
|
||||||
@@ -23,3 +25,4 @@ pnpm-debug.log*
|
|||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
/admin-ui.iml
|
/admin-ui.iml
|
||||||
|
.gstack/
|
||||||
|
|||||||
290
CLAUDE.md
Normal file
290
CLAUDE.md
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
## Repository Collaboration Rules
|
||||||
|
|
||||||
|
These rules capture long-term repository preferences confirmed by the user and should be applied in future sessions unless the user explicitly overrides them.
|
||||||
|
|
||||||
|
### Pagination Rules
|
||||||
|
|
||||||
|
- Prefer the project global `pagination` component by default.
|
||||||
|
- Pagination should be fixed and visible as part of the page or dialog layout, not conditionally hidden only because the dataset is small.
|
||||||
|
- In single-page scenarios, the UI should still show total count together with the pagination area.
|
||||||
|
- Avoid designs where pagination only appears after data exceeds one page.
|
||||||
|
|
||||||
|
### Dialog Layout Rules
|
||||||
|
|
||||||
|
- For dialogs that contain searchable tabular data, prefer this structure:
|
||||||
|
1. search area
|
||||||
|
2. table/content area
|
||||||
|
3. pagination area placed under the table inside the dialog body
|
||||||
|
4. footer action buttons
|
||||||
|
- The pagination area should remain visually stable and should not be omitted just because the current result set is small.
|
||||||
|
|
||||||
|
### Theme and Style Rules
|
||||||
|
|
||||||
|
- When functionality and existing theme style conflict, prioritize making the feature clearly visible and usable first.
|
||||||
|
- After ensuring usability, align the implementation with the repository's existing theme and style system as much as possible.
|
||||||
|
- Be cautious about global theme styles that may affect local pagination, dialog, or table layouts.
|
||||||
|
|
||||||
|
### Problem-solving Workflow
|
||||||
|
|
||||||
|
- For repeated UI issues, analyze in this order:
|
||||||
|
1. interface/request data and returned structure
|
||||||
|
2. component logic and render conditions
|
||||||
|
3. theme and style coverage/conflicts
|
||||||
|
4. then decide whether a rewrite is necessary
|
||||||
|
- Do not jump straight to a rewrite before checking interface behavior and style interference.
|
||||||
|
|
||||||
|
### Execution Workflow Rules
|
||||||
|
|
||||||
|
- When modifying a feature, locate it in this order: usage location, component definition, API definition, then at least one similar implementation in the project.
|
||||||
|
- For common UI features such as pagination, dialogs, and tables, align with an existing similar implementation before making changes.
|
||||||
|
- Prefer componentization. If a page or Vue SFC is already large, or a block has a clear independent responsibility, split it into components instead of continuing to extend the same file.
|
||||||
|
- For very long files such as complex page-level `index.vue` files, treat further component splitting as the default direction rather than the exception.
|
||||||
|
- Before editing large files or complex Vue SFCs, first read the target context; if a replacement fails once, do not repeat the same replacement blindly, and instead expand the context or switch to smaller targeted edits.
|
||||||
|
- After UI or interaction changes, verify not only lint status for edited files but also render conditions, interface fields, and possible style impact.
|
||||||
|
- If the same issue is not resolved after one attempt, pause and ask the user before continuing with more speculative changes.
|
||||||
|
- Do not proactively rewrite a component unless the user explicitly asks for a rewrite.
|
||||||
|
- At the start of a new conversation, read `CLAUDE.md` before making changes.
|
||||||
|
- When code changes appear not to take effect, check in this order: compile/HMR status, render conditions, API data, then style overrides.
|
||||||
|
- Turn repeated low-level mistakes into explicit workflow checks and follow those checks in future edits.
|
||||||
|
|
||||||
|
### Environment and Tool Selection Rules
|
||||||
|
|
||||||
|
- Before running environment-dependent commands, first follow the known runtime context already provided by the IDE, such as OS and default shell.
|
||||||
|
- On Windows projects with PowerShell as the active shell, prefer PowerShell-native commands and scripts by default.
|
||||||
|
- Do not assume Python, bash, sed, awk, or other non-default tooling is installed locally unless the user or repository explicitly indicates that they are available.
|
||||||
|
- For reading and editing repository files, prefer dedicated file tools first; use shell-based text replacement only when file tools are not suitable for the change.
|
||||||
|
- When a replacement fails once, do not keep retrying the same method blindly. Re-read the exact target content and switch to a smaller or more reliable edit strategy that matches the current environment.
|
||||||
|
- Avoid trial-and-error probing for basic tooling when the available environment is already known from context.
|
||||||
|
|
||||||
|
### Componentization and Structure Rules
|
||||||
|
|
||||||
|
- If a view block has an independent responsibility, prefer extracting it into a component instead of keeping it inside a large page file.
|
||||||
|
- When a file is already long, or a new feature would further expand responsibilities, proactively split it into components.
|
||||||
|
- Child components may keep their own local logic when that logic belongs clearly to the child’s responsibility; only shared state and necessary events should stay in the parent.
|
||||||
|
- For complex pages, small-scale components can stay in `component/`, while larger feature areas may be grouped by responsibility in subdirectories.
|
||||||
|
- For very long page files, prefer keeping the parent focused on composition, state orchestration, and data flow, while moving feature UI and local behavior into child components.
|
||||||
|
- When extracting new child components from a large file, move their related local styles with them to avoid continued growth of the parent file.
|
||||||
|
|
||||||
|
### API and Data Handling Rules
|
||||||
|
|
||||||
|
- Follow the project’s common response structure by default, but add moderate component-side compatibility handling when equivalent APIs return slightly inconsistent fields.
|
||||||
|
- For page-level error handling, use global handling by default, but use page-level or silent handling when the interaction requires local control.
|
||||||
|
- Prefer a unified parameter-building entry for request params instead of assembling the same parameters across multiple functions.
|
||||||
|
|
||||||
|
### Form and Interaction Rules
|
||||||
|
|
||||||
|
- Follow the project’s existing form behavior style: required fields should be clearly validated on submit, while avoiding unnecessarily disruptive validation during input.
|
||||||
|
- For shared create/edit forms, initialize, patch, and reset form state through a unified initialization path to avoid stale state.
|
||||||
|
- Search interactions should behave consistently across button click, Enter key, and clear actions, and should reset to the first page by default.
|
||||||
|
|
||||||
|
### Dialog and Selector Rules
|
||||||
|
|
||||||
|
- Dialogs should clear temporary internal state on close by default; any state that needs to persist should be explicitly provided back by the parent.
|
||||||
|
- Selector components should follow a consistent pattern: `v-model` for visibility, a default value prop, and a `confirm` event for returning the selected result.
|
||||||
|
- For temporary selectors and lightweight dialogs, prefer `destroy-on-close`; for more complex stateful forms, decide deliberately rather than applying it blindly.
|
||||||
|
|
||||||
|
### Styling Rules
|
||||||
|
|
||||||
|
- Prefer local scoped style changes first; only modify global theme styles after confirming the issue is truly shared across multiple places.
|
||||||
|
- When overriding Element Plus internals, prefer local `:deep()` overrides before considering global style changes.
|
||||||
|
- Use semantic, area-based class names instead of short or overly generic names.
|
||||||
|
|
||||||
|
### Debugging and Validation Rules
|
||||||
|
|
||||||
|
- Minimal temporary debugging is allowed when necessary, but all temporary debugging code must be removed before final delivery.
|
||||||
|
- Temporary `console` output is acceptable only when debugging is genuinely needed and must be removed before final delivery.
|
||||||
|
- For UI and interaction changes, verify lint, key render conditions, interface fields, and style impact before considering the task complete.
|
||||||
|
|
||||||
|
### Change Scope and Consistency Rules
|
||||||
|
|
||||||
|
- Prefer the smallest necessary change set, but do not pretend a local-only fix is sufficient when the real root cause is elsewhere in the chain.
|
||||||
|
- Only fix nearby issues when they are strongly related to the current task; otherwise ask the user before expanding the scope.
|
||||||
|
- Within the current modification scope, move code toward repository rules when practical, but avoid broad unrelated refactors.
|
||||||
|
|
||||||
|
### Communication and Risk Rules
|
||||||
|
|
||||||
|
- 默认使用中文进行回复、说明、提问与思考表达;如果用户明确要求使用其他语言,再按用户要求切换。
|
||||||
|
- Before changing code, confirm with the user when a change involves a rewrite, global side effects, unclear requirements, or a second attempt that still has not solved the issue.
|
||||||
|
- After changes, explain what changed, why it was changed that way, and any remaining risks or points worth confirming.
|
||||||
|
- When a requirement still depends on a meaningful assumption, ask the user first instead of silently choosing a direction.
|
||||||
|
|
||||||
|
### Repository Memory Rules
|
||||||
|
|
||||||
|
- When collaboration reveals a repeated problem pattern, proactively suggest turning it into an explicit repository rule in `CLAUDE.md`.
|
||||||
|
- Project-specific experience or pitfall notes may be added when they become necessary, but do not expand them prematurely without clear recurring value.
|
||||||
|
|
||||||
|
### Rule Documentation Style
|
||||||
|
|
||||||
|
- Keep long-term repository rules concise and practical.
|
||||||
|
- Prefer short rule lists with a small amount of explanation over overly long documentation.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
## AI Skills
|
||||||
|
|
||||||
|
本项目已全局安装 **gstack** 和 **Superpowers** 两组技能(skill),通过斜杠命令调用。
|
||||||
|
|
||||||
|
### gstack — 浏览器验证与发布
|
||||||
|
|
||||||
|
负责 QA 测试、浏览器自动化、安全审计、代码审查和发布部署。
|
||||||
|
|
||||||
|
| 阶段 | 命令 | 功能 |
|
||||||
|
|------|------|------|
|
||||||
|
| **审查** | `/gstack-review` | 代码审查,自动修复明显问题,标记完整性缺口 |
|
||||||
|
| | `/gstack-cso` | 安全审计(OWASP Top 10 + STRIDE),含漏洞验证 |
|
||||||
|
| **QA 测试** | `/gstack-qa <url>` | 打开浏览器进行功能测试,发现 bug 并自动修复 |
|
||||||
|
| | `/gstack-qa-only <url>` | 仅检测并报告 bug,不修改代码 |
|
||||||
|
| | `/gstack-browse` | AI 浏览网页内容(通过 Playwright + 系统 Chrome) |
|
||||||
|
| | `/gstack-scrape` | 抓取网页内容 |
|
||||||
|
| **性能** | `/gstack-benchmark` | 页面加载性能基准测试 |
|
||||||
|
| | `/gstack-canary` | 部署后监控:控制台错误、性能回归、页面故障 |
|
||||||
|
| **发布** | `/gstack-ship` | 同步主分支、运行测试、推送、创建 PR |
|
||||||
|
| | `/gstack-land-and-deploy` | 合并 PR、等待 CI、部署、验证生产环境 |
|
||||||
|
| **诊断** | `/gstack-investigate` | 系统性根因调试 |
|
||||||
|
| | `/gstack-retro` | 迭代回顾分析 |
|
||||||
|
|
||||||
|
浏览器功能依赖 Playwright,已配置使用系统 Chrome(`C:\Program Files\Google\Chrome\Application\chrome.exe`),无需额外下载浏览器。
|
||||||
|
|
||||||
|
### Superpowers — 思考与计划
|
||||||
|
|
||||||
|
负责头脑风暴、方案设计、计划编写与执行、系统性调试。
|
||||||
|
|
||||||
|
| 阶段 | 命令 | 功能 |
|
||||||
|
|------|------|------|
|
||||||
|
| **构思** | `/sp-brainstorm` | 交互式头脑风暴,梳理需求和方案 |
|
||||||
|
| | `/sp-using-superpowers` | Superpowers 使用指南 |
|
||||||
|
| **计划** | `/sp-write-plan` | 编写实现计划 |
|
||||||
|
| | `/sp-execute-plan` | 按批次执行计划 |
|
||||||
|
| **开发** | `/sp-subagent-dev` | 子代理驱动开发:规范→审查→实现→验证 |
|
||||||
|
| | `/sp-tdd` | 测试驱动开发工作流 |
|
||||||
|
| | `/sp-dispatch-agents` | 并行分发子代理任务 |
|
||||||
|
| **调试** | `/sp-debug` | 系统性调试方法论 |
|
||||||
|
| **审查** | `/sp-request-review` | 请求代码审查 |
|
||||||
|
| | `/sp-receive-review` | 接收并处理审查反馈 |
|
||||||
|
| **完成** | `/sp-verify` | 完成前验证检查 |
|
||||||
|
| | `/sp-finish-branch` | 完成开发分支 |
|
||||||
|
| **工具** | `/sp-write-skills` | 编写自定义 skill |
|
||||||
|
| | `/sp-git-worktrees` | Git 工作树使用指南 |
|
||||||
|
|
||||||
|
### 工作流建议
|
||||||
|
|
||||||
|
推荐开发流程按此顺序使用两组 skill:
|
||||||
|
|
||||||
|
```
|
||||||
|
/sp-brainstorm → 梳理需求
|
||||||
|
/sp-write-plan → 编写实现计划
|
||||||
|
(编码实现)
|
||||||
|
/gstack-review → 代码审查
|
||||||
|
/gstack-qa <url> → QA 测试
|
||||||
|
/gstack-cso → 安全检查
|
||||||
|
/gstack-ship → 发布
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# ==================== 第一阶段:构建前端 ====================
|
# ==================== 第一阶段:构建前端 ====================
|
||||||
FROM node:18-alpine AS builder
|
FROM docker.m.daocloud.io/node:18-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# 配置Alpine国内镜像源
|
# 配置Alpine国内镜像源
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
@@ -13,7 +13,7 @@ COPY . .
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ==================== 第二阶段:部署到Nginx ====================
|
# ==================== 第二阶段:部署到Nginx ====================
|
||||||
FROM nginx:alpine
|
FROM docker.m.daocloud.io/nginx:alpine
|
||||||
|
|
||||||
# 复制构建产物
|
# 复制构建产物
|
||||||
COPY --from=builder /app/dist/ /usr/share/nginx/html/
|
COPY --from=builder /app/dist/ /usr/share/nginx/html/
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
# 配置Alpine国内镜像源(加速apk)
|
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
RUN npm install --registry=https://registry.npmmirror.com
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
CMD ["npm", "run", "dev"]
|
|
||||||
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
|
||||||
82
ngnix.conf
82
ngnix.conf
@@ -1,6 +1,20 @@
|
|||||||
# Nginx 静态文件服务 + 智能代理
|
# Nginx 静态文件服务 + 智能代理 + 自定义 404 页面
|
||||||
|
|
||||||
# HTTP 重定向到 HTTPS
|
# Gitea 域名转发(HTTP)
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name gitea.redpowerfuture.com;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
# MinIO 域名转发(HTTP)
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name minio.redpowerfuture.com;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
# HTTP 重定向到 HTTPS(其他域名)
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
@@ -19,11 +33,27 @@ server {
|
|||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
# 自定义 404 页面,保持 404 状态码
|
||||||
|
error_page 404 /404.html;
|
||||||
|
|
||||||
|
location = /404.html {
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
|
||||||
# 根路径默认进入网页端
|
# 根路径默认进入网页端
|
||||||
location = / {
|
location = / {
|
||||||
return 302 /web/index.html;
|
return 302 /web/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 兼容无斜杠访问
|
||||||
|
location = /web {
|
||||||
|
return 302 /web/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /sys {
|
||||||
|
return 302 /sys/;
|
||||||
|
}
|
||||||
|
|
||||||
# 网页端(public/web/index.html -> dist/web/index.html)
|
# 网页端(public/web/index.html -> dist/web/index.html)
|
||||||
location /web/ {
|
location /web/ {
|
||||||
alias /usr/share/nginx/html/web/;
|
alias /usr/share/nginx/html/web/;
|
||||||
@@ -33,7 +63,7 @@ server {
|
|||||||
# 后台管理端(dist/index.html,前缀 /sys/)
|
# 后台管理端(dist/index.html,前缀 /sys/)
|
||||||
location /sys/ {
|
location /sys/ {
|
||||||
alias /usr/share/nginx/html/;
|
alias /usr/share/nginx/html/;
|
||||||
try_files $uri $uri/ /sys/index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 1. 先尝试作为静态文件查找
|
# 1. 先尝试作为静态文件查找
|
||||||
@@ -60,3 +90,49 @@ server {
|
|||||||
proxy_read_timeout 30s;
|
proxy_read_timeout 30s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Gitea 域名转发(HTTPS)
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name gitea.redpowerfuture.com;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/ssl/gitea.redpowerfuture.com.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/gitea.redpowerfuture.com.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://gitea.redpowerfuture.com:3000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_connect_timeout 30s;
|
||||||
|
proxy_send_timeout 30s;
|
||||||
|
proxy_read_timeout 30s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# MinIO 域名转发(HTTPS)
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name minio.redpowerfuture.com;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/ssl/minio.redpowerfuture.com.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/minio.redpowerfuture.com.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://minio.redpowerfuture.com:9000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_connect_timeout 30s;
|
||||||
|
proxy_send_timeout 30s;
|
||||||
|
proxy_read_timeout 30s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
201
package-lock.json
generated
201
package-lock.json
generated
@@ -14,6 +14,10 @@
|
|||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@logicflow/core": "^2.2.1",
|
"@logicflow/core": "^2.2.1",
|
||||||
"@logicflow/extension": "^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",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"axios": "1.8.2",
|
"axios": "1.8.2",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
@@ -2243,6 +2247,98 @@
|
|||||||
"vscode-uri": "^3.0.8"
|
"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": {
|
"node_modules/@vue/compiler-core": {
|
||||||
"version": "3.5.25",
|
"version": "3.5.25",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz",
|
||||||
@@ -2950,6 +3046,111 @@
|
|||||||
"node": ">=0.12"
|
"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": {
|
"node_modules/dayjs": {
|
||||||
"version": "1.11.19",
|
"version": "1.11.19",
|
||||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
|
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
"@element-plus/icons-vue": "^2.3.1",
|
"@element-plus/icons-vue": "^2.3.1",
|
||||||
"@logicflow/core": "^2.2.1",
|
"@logicflow/core": "^2.2.1",
|
||||||
"@logicflow/extension": "^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",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"axios": "1.8.2",
|
"axios": "1.8.2",
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
|
|||||||
212
public/404.html
Normal file
212
public/404.html
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>404 - 页面不存在</title>
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
color-scheme: light;
|
||||||
|
--bg-start: #f5f7fa;
|
||||||
|
--bg-end: #e8ecf3;
|
||||||
|
--card-bg: rgba(255, 255, 255, 0.92);
|
||||||
|
--text-primary: #1f2d3d;
|
||||||
|
--text-secondary: #6b7280;
|
||||||
|
--accent: #409eff;
|
||||||
|
--accent-hover: #66b1ff;
|
||||||
|
--border: rgba(64, 158, 255, 0.12);
|
||||||
|
--shadow: 0 20px 50px rgba(31, 45, 61, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
min-height: 100vh;
|
||||||
|
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||||
|
background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card {
|
||||||
|
width: min(960px, 100%);
|
||||||
|
background: var(--card-bg);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 24px;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
display: flex;
|
||||||
|
gap: 48px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-code {
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(64px, 12vw, 110px);
|
||||||
|
line-height: 1;
|
||||||
|
color: var(--accent);
|
||||||
|
letter-spacing: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-title {
|
||||||
|
margin: 20px 0 12px;
|
||||||
|
font-size: 30px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-message {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-actions {
|
||||||
|
margin-top: 32px;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
appearance: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 12px 22px;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button.primary {
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 12px 24px rgba(64, 158, 255, 0.24);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button.primary:hover {
|
||||||
|
background: var(--accent-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button.secondary {
|
||||||
|
background: #fff;
|
||||||
|
color: var(--text-primary);
|
||||||
|
border: 1px solid rgba(31, 45, 61, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-illustration {
|
||||||
|
flex: 0 0 320px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.illustration-shell {
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 1 / 1;
|
||||||
|
border-radius: 32px;
|
||||||
|
background: linear-gradient(160deg, rgba(64, 158, 255, 0.12), rgba(64, 158, 255, 0.02));
|
||||||
|
border: 1px solid rgba(64, 158, 255, 0.14);
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.illustration-shell::before,
|
||||||
|
.illustration-shell::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(64, 158, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.illustration-shell::before {
|
||||||
|
width: 180px;
|
||||||
|
height: 180px;
|
||||||
|
top: -30px;
|
||||||
|
right: -30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.illustration-shell::after {
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
left: -20px;
|
||||||
|
bottom: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.illustration-center {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: clamp(72px, 10vw, 120px);
|
||||||
|
font-weight: 800;
|
||||||
|
color: rgba(64, 158, 255, 0.85);
|
||||||
|
letter-spacing: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.error-card {
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 36px 24px;
|
||||||
|
gap: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-illustration {
|
||||||
|
flex-basis: auto;
|
||||||
|
width: min(320px, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-title {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main class="error-page">
|
||||||
|
<section class="error-card">
|
||||||
|
<div class="error-content">
|
||||||
|
<h1 class="error-code">404</h1>
|
||||||
|
<h2 class="error-title">抱歉,你访问的页面不存在</h2>
|
||||||
|
<p class="error-message">
|
||||||
|
当前地址可能已失效、输入有误,或者对应内容已被移动。你可以返回首页,或回到后台入口继续操作。
|
||||||
|
</p>
|
||||||
|
<div class="error-actions">
|
||||||
|
<a class="action-button primary" href="/">返回首页</a>
|
||||||
|
<a class="action-button secondary" href="/sys/">进入后台</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="error-illustration" aria-hidden="true">
|
||||||
|
<div class="illustration-shell">
|
||||||
|
<div class="illustration-center">404</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -12,7 +12,7 @@ export interface ApiInterfaceQueryParams {
|
|||||||
|
|
||||||
// 创建接口参数
|
// 创建接口参数
|
||||||
export interface CreateApiInterfaceParams {
|
export interface CreateApiInterfaceParams {
|
||||||
platformId: string | number;
|
platformId: number;
|
||||||
name: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
url: string;
|
url: string;
|
||||||
@@ -22,6 +22,7 @@ export interface CreateApiInterfaceParams {
|
|||||||
requestConfig?: Record<string, any>;
|
requestConfig?: Record<string, any>;
|
||||||
responseConfig?: Record<string, any>;
|
responseConfig?: Record<string, any>;
|
||||||
limitConfig?: Record<string, any>;
|
limitConfig?: Record<string, any>;
|
||||||
|
tableDefinition?: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新接口参数
|
// 更新接口参数
|
||||||
@@ -50,6 +51,7 @@ export interface ApiInterfaceInfo {
|
|||||||
requestConfig?: Record<string, any>;
|
requestConfig?: Record<string, any>;
|
||||||
responseConfig?: Record<string, any>;
|
responseConfig?: Record<string, any>;
|
||||||
limitConfig?: Record<string, any>;
|
limitConfig?: Record<string, any>;
|
||||||
|
tableDefinition?: Record<string, any>;
|
||||||
createdBy?: string;
|
createdBy?: string;
|
||||||
createdAt?: number;
|
createdAt?: number;
|
||||||
updatedBy?: string;
|
updatedBy?: string;
|
||||||
@@ -59,7 +61,7 @@ export interface ApiInterfaceInfo {
|
|||||||
// 获取接口列表
|
// 获取接口列表
|
||||||
export function listApiInterfaces(params: ApiInterfaceQueryParams) {
|
export function listApiInterfaces(params: ApiInterfaceQueryParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/listApiInterfaces',
|
url: '/data-engine/api/interface/controller/listApiInterfaces',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
@@ -68,7 +70,7 @@ export function listApiInterfaces(params: ApiInterfaceQueryParams) {
|
|||||||
// 获取接口详情
|
// 获取接口详情
|
||||||
export function getApiInterface(id: string) {
|
export function getApiInterface(id: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/getApiInterface',
|
url: '/data-engine/api/interface/controller/getApiInterface',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { id },
|
params: { id },
|
||||||
});
|
});
|
||||||
@@ -77,7 +79,7 @@ export function getApiInterface(id: string) {
|
|||||||
// 创建接口
|
// 创建接口
|
||||||
export function createApiInterface(data: CreateApiInterfaceParams) {
|
export function createApiInterface(data: CreateApiInterfaceParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/createApiInterface',
|
url: '/data-engine/api/interface/controller/createApiInterface',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -86,7 +88,7 @@ export function createApiInterface(data: CreateApiInterfaceParams) {
|
|||||||
// 修改接口
|
// 修改接口
|
||||||
export function updateApiInterface(data: UpdateApiInterfaceParams) {
|
export function updateApiInterface(data: UpdateApiInterfaceParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/updateApiInterface',
|
url: '/data-engine/api/interface/controller/updateApiInterface',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -95,7 +97,7 @@ export function updateApiInterface(data: UpdateApiInterfaceParams) {
|
|||||||
// 更新接口状态
|
// 更新接口状态
|
||||||
export function updateApiInterfaceStatus(data: UpdateApiInterfaceStatusParams) {
|
export function updateApiInterfaceStatus(data: UpdateApiInterfaceStatusParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/updateApiInterfaceStatus',
|
url: '/data-engine/api/interface/controller/updateApiInterfaceStatus',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -104,7 +106,7 @@ export function updateApiInterfaceStatus(data: UpdateApiInterfaceStatusParams) {
|
|||||||
// 删除接口
|
// 删除接口
|
||||||
export function deleteApiInterface(id: string) {
|
export function deleteApiInterface(id: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/interface/controller/deleteApiInterface',
|
url: '/data-engine/api/interface/controller/deleteApiInterface',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
params: { id },
|
params: { id },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ export interface CreateDatasourcePlatformParams {
|
|||||||
requestTimeoutMs?: number;
|
requestTimeoutMs?: number;
|
||||||
maxRetries?: number;
|
maxRetries?: number;
|
||||||
retryDelayMs?: number;
|
retryDelayMs?: number;
|
||||||
createdBy?: string;
|
authConfig?: Record<string, any>;
|
||||||
updatedBy?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新平台参数
|
// 更新平台参数
|
||||||
@@ -40,7 +39,6 @@ export interface UpdateDatasourcePlatformParams extends Partial<CreateDatasource
|
|||||||
export interface UpdateDatasourcePlatformStatusParams {
|
export interface UpdateDatasourcePlatformStatusParams {
|
||||||
id: string;
|
id: string;
|
||||||
Status: string;
|
Status: string;
|
||||||
updatedBy?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 平台信息
|
// 平台信息
|
||||||
@@ -54,22 +52,25 @@ export interface DatasourcePlatformInfo {
|
|||||||
apiBaseUrl: string;
|
apiBaseUrl: string;
|
||||||
authType: string;
|
authType: string;
|
||||||
authTypeName: string;
|
authTypeName: string;
|
||||||
|
token?: string;
|
||||||
|
apiKey?: string;
|
||||||
|
clientId?: string;
|
||||||
|
clientSecret?: string;
|
||||||
|
authConfig?: Record<string, any>;
|
||||||
rateLimitPerMinute?: number;
|
rateLimitPerMinute?: number;
|
||||||
rateLimitPerHour?: number;
|
rateLimitPerHour?: number;
|
||||||
concurrencyLimit?: number;
|
concurrencyLimit?: number;
|
||||||
requestTimeoutMs?: number;
|
requestTimeoutMs?: number;
|
||||||
maxRetries?: number;
|
maxRetries?: number;
|
||||||
retryDelayMs?: number;
|
retryDelayMs?: number;
|
||||||
createdBy?: string;
|
|
||||||
createdAt?: number;
|
createdAt?: number;
|
||||||
updatedBy?: string;
|
|
||||||
updatedAt?: number;
|
updatedAt?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取平台列表
|
// 获取平台列表
|
||||||
export function listDatasourcePlatforms(params: DatasourcePlatformQueryParams) {
|
export function listDatasourcePlatforms(params: DatasourcePlatformQueryParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/listDatasourcePlatforms',
|
url: '/data-engine/datasource/platform/controller/listDatasourcePlatforms',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
@@ -78,7 +79,7 @@ export function listDatasourcePlatforms(params: DatasourcePlatformQueryParams) {
|
|||||||
// 创建平台
|
// 创建平台
|
||||||
export function createDatasourcePlatform(data: CreateDatasourcePlatformParams) {
|
export function createDatasourcePlatform(data: CreateDatasourcePlatformParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/createDatasourcePlatform',
|
url: '/data-engine/datasource/platform/controller/createDatasourcePlatform',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -87,7 +88,7 @@ export function createDatasourcePlatform(data: CreateDatasourcePlatformParams) {
|
|||||||
// 更新平台
|
// 更新平台
|
||||||
export function updateDatasourcePlatform(data: UpdateDatasourcePlatformParams) {
|
export function updateDatasourcePlatform(data: UpdateDatasourcePlatformParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/updateDatasourcePlatform',
|
url: '/data-engine/datasource/platform/controller/updateDatasourcePlatform',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
@@ -96,7 +97,7 @@ export function updateDatasourcePlatform(data: UpdateDatasourcePlatformParams) {
|
|||||||
// 删除平台
|
// 删除平台
|
||||||
export function deleteDatasourcePlatform(id: string) {
|
export function deleteDatasourcePlatform(id: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/deleteDatasourcePlatform',
|
url: '/data-engine/datasource/platform/controller/deleteDatasourcePlatform',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
params: { id },
|
params: { id },
|
||||||
});
|
});
|
||||||
@@ -105,7 +106,7 @@ export function deleteDatasourcePlatform(id: string) {
|
|||||||
// 获取平台详情
|
// 获取平台详情
|
||||||
export function getDatasourcePlatform(id: string) {
|
export function getDatasourcePlatform(id: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/getDatasourcePlatform',
|
url: '/data-engine/datasource/platform/controller/getDatasourcePlatform',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { id },
|
params: { id },
|
||||||
});
|
});
|
||||||
@@ -114,7 +115,7 @@ export function getDatasourcePlatform(id: string) {
|
|||||||
// 根据编码获取平台信息
|
// 根据编码获取平台信息
|
||||||
export function getPlatformByCode(platformCode: string) {
|
export function getPlatformByCode(platformCode: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/getPlatformByCode',
|
url: '/data-engine/datasource/platform/controller/getPlatformByCode',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: { platformCode },
|
params: { platformCode },
|
||||||
});
|
});
|
||||||
@@ -123,7 +124,7 @@ export function getPlatformByCode(platformCode: string) {
|
|||||||
// 更新平台状态
|
// 更新平台状态
|
||||||
export function updateDatasourcePlatformStatus(data: UpdateDatasourcePlatformStatusParams) {
|
export function updateDatasourcePlatformStatus(data: UpdateDatasourcePlatformStatusParams) {
|
||||||
return request({
|
return request({
|
||||||
url: '/datasource/platform/controller/updateDatasourcePlatformStatus',
|
url: '/data-engine/datasource/platform/controller/updateDatasourcePlatformStatus',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,30 +5,42 @@ export interface knowledgeQueryParams {
|
|||||||
keyword?: string;
|
keyword?: string;
|
||||||
pageNum: number;
|
pageNum: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
|
datasetType?: number; // 1=文本,2=视频
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建知识库参数
|
// 创建知识库参数
|
||||||
export interface CreateknowledgeParams {
|
export interface CreateknowledgeParams {
|
||||||
name: string; // 必传
|
name: string; // 必传
|
||||||
|
datasetType: number; // 1=文本,2=视频
|
||||||
description?: string; // 可选
|
description?: string; // 可选
|
||||||
|
embeddingModel?: string; // 向量模型
|
||||||
|
status?: string; // 状态
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新知识库参数
|
// 更新知识库参数
|
||||||
export interface UpdateknowledgeParams {
|
export interface UpdateknowledgeParams {
|
||||||
id: string; // 必传
|
id: string; // 必传
|
||||||
name?: string; // 可选
|
name?: string; // 可选
|
||||||
|
datasetType?: number; // 1=文本,2=视频
|
||||||
description?: string; // 可选
|
description?: string; // 可选
|
||||||
|
embeddingModel?: string; // 向量模型
|
||||||
|
status?: string; // 状态
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据集信息
|
// 数据集信息
|
||||||
export interface knowledgeInfo {
|
export interface knowledgeInfo {
|
||||||
id?: string;
|
id?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
datasetType?: number; // 1=文本,2=视频
|
||||||
description?: string;
|
description?: string;
|
||||||
fileCount?: number;
|
fileCount?: number;
|
||||||
totalSize?: number;
|
totalSize?: number;
|
||||||
createdAt?: string;
|
createdAt?: string;
|
||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
|
embeddingModel?: string; // 向量模型
|
||||||
|
documentCount?: number; // 文档数量
|
||||||
|
charCount?: number; // 字符数量
|
||||||
|
status?: string; // 状态
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取知识库列表
|
// 获取知识库列表
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ export interface NodeLibraryItem {
|
|||||||
nodeName: string;
|
nodeName: string;
|
||||||
modelType: number;
|
modelType: number;
|
||||||
skillOption: boolean;
|
skillOption: boolean;
|
||||||
|
promptOption: boolean;
|
||||||
|
isSaveFile: boolean;
|
||||||
formConfig: NodeLibraryFormItem[];
|
formConfig: NodeLibraryFormItem[];
|
||||||
modelConfig: NodeLibraryModelConfig[];
|
modelConfig: NodeLibraryModelConfig[];
|
||||||
}
|
}
|
||||||
@@ -86,6 +88,7 @@ export interface ExecutionItem {
|
|||||||
timestamp: string;
|
timestamp: string;
|
||||||
content: string;
|
content: string;
|
||||||
label: string;
|
label: string;
|
||||||
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExecutionFlowItem {
|
export interface ExecutionFlowItem {
|
||||||
|
|||||||
@@ -20,6 +20,41 @@ export interface ModelFormEntry {
|
|||||||
value: string;
|
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 接口项,字段名以后端为准,前端做兼容解析) */
|
/** 模型类型(listType 接口项,字段名以后端为准,前端做兼容解析) */
|
||||||
export interface ModelTypeListItem {
|
export interface ModelTypeListItem {
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
@@ -84,18 +119,22 @@ export interface ModelModuleItem {
|
|||||||
/** 会话开关状态(列表接口返回,0 关 1 开;会话开关接口就绪后生效) */
|
/** 会话开关状态(列表接口返回,0 关 1 开;会话开关接口就绪后生效) */
|
||||||
chatSessionEnabled?: number;
|
chatSessionEnabled?: number;
|
||||||
enabled: number;
|
enabled: number;
|
||||||
|
/** 调用模式:0-同步 1-异步 2-流式 */
|
||||||
|
callMode?: number;
|
||||||
maxConcurrency: number;
|
maxConcurrency: number;
|
||||||
queueLimit: number;
|
queueLimit?: number;
|
||||||
timeoutMs?: number;
|
timeoutMs?: number;
|
||||||
timeoutSeconds?: number;
|
timeoutSeconds?: number;
|
||||||
expectedSeconds?: number;
|
expectedSeconds?: number;
|
||||||
retryTimes: number;
|
retryTimes: number;
|
||||||
retryQueueMaxSeconds: number;
|
retryQueueMaxSeconds?: number;
|
||||||
autoCleanSeconds: number;
|
autoCleanSeconds: number;
|
||||||
remark?: string;
|
headMsg?: string | Record<string, string>;
|
||||||
headMsg?: string;
|
|
||||||
form?: ModelFormEntry[] | Record<string, { value: string }>;
|
form?: ModelFormEntry[] | Record<string, { value: string }>;
|
||||||
requestMapping?: Record<string, unknown>;
|
requestMapping?: Record<string, unknown>;
|
||||||
|
requiredFields?: string[];
|
||||||
|
firstFrame?: string;
|
||||||
|
lastFrame?: string;
|
||||||
responseMapping?: Record<string, unknown>;
|
responseMapping?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,27 +154,32 @@ export interface CreateModelParams {
|
|||||||
operatorName?: string;
|
operatorName?: string;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
httpMethod?: string;
|
httpMethod?: string;
|
||||||
headMsg?: string;
|
headMsg?: Record<string, string>;
|
||||||
isPrivate: number;
|
isPrivate: number;
|
||||||
enabled: number;
|
enabled: number;
|
||||||
isChatModel: number;
|
isChatModel: number;
|
||||||
|
/** 调用模式:0-同步 1-异步 2-流式,默认0 */
|
||||||
|
callMode: number;
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
form: ModelFormEntry[];
|
form: ModelFormEntry[];
|
||||||
requestMapping?: Record<string, unknown>;
|
requestMapping?: Record<string, unknown>;
|
||||||
|
requiredFields?: string[];
|
||||||
|
firstFrame?: string;
|
||||||
|
lastFrame?: string;
|
||||||
responseMapping?: Record<string, unknown>;
|
responseMapping?: Record<string, unknown>;
|
||||||
responseBody?: Record<string, unknown>;
|
responseBody?: string;
|
||||||
extendMapping?: Record<string, unknown>;
|
extendMapping?: Record<string, unknown>;
|
||||||
responseTokenField?: string;
|
responseTokenField?: string;
|
||||||
tokenConfig?: Record<string, unknown>;
|
tokenConfig?: Record<string, unknown>;
|
||||||
queryConfig?: Record<string, unknown>;
|
queryConfig?: Record<string, unknown>;
|
||||||
|
streamConfig?: Record<string, unknown>;
|
||||||
maxConcurrency?: number;
|
maxConcurrency?: number;
|
||||||
queueLimit?: number;
|
queueLimit?: number;
|
||||||
timeoutSeconds: number;
|
timeoutSeconds: number;
|
||||||
expectedSeconds: number;
|
expectedSeconds?: number;
|
||||||
retryTimes?: number;
|
retryTimes?: number;
|
||||||
retryQueueMaxSeconds: number;
|
retryQueueMaxSeconds?: number;
|
||||||
autoCleanSeconds: number;
|
autoCleanSeconds: number;
|
||||||
remark?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelConfigTypeItem {
|
export interface ModelConfigTypeItem {
|
||||||
@@ -251,3 +295,46 @@ export function getOperatorList() {
|
|||||||
method: 'get',
|
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',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
149
src/api/settings/promptManager/index.ts
Normal file
149
src/api/settings/promptManager/index.ts
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
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; // 1-管理员 2-用户
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PromptListResponse {
|
||||||
|
list: PromptItem[];
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PromptListParams {
|
||||||
|
pageNum?: number;
|
||||||
|
pageSize?: number;
|
||||||
|
keyword?: string;
|
||||||
|
nodeType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreatePromptParams {
|
||||||
|
nodeType: string;
|
||||||
|
prompt: string;
|
||||||
|
sourceType: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CheckIsSuperAdminResponse {
|
||||||
|
isSuperAdmin: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreatePromptResponse {
|
||||||
|
id?: number | string;
|
||||||
|
tenantId?: number;
|
||||||
|
creator?: string;
|
||||||
|
createdAt?: string;
|
||||||
|
updater?: string;
|
||||||
|
updatedAt?: string;
|
||||||
|
deletedAt?: string | null;
|
||||||
|
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 getPromptList(params: PromptListParams) {
|
||||||
|
return request<PromptListResponse>({
|
||||||
|
url: '/ai-agent/node/prompt/list',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户提示词列表
|
||||||
|
*/
|
||||||
|
export function getMyPromptList(params: PromptListParams) {
|
||||||
|
return request<PromptListResponse>({
|
||||||
|
url: '/ai-agent/node/prompt/listMy',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建提示词
|
||||||
|
*/
|
||||||
|
export function createPrompt(data: CreatePromptParams) {
|
||||||
|
return request<CreatePromptResponse>({
|
||||||
|
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 },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前用户是否为超级管理员
|
||||||
|
*/
|
||||||
|
export function checkIsSuperAdmin() {
|
||||||
|
return request<CheckIsSuperAdminResponse>({
|
||||||
|
url: '/admin-go/api/v1/system/user/checkIsSuperAdmin',
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -118,15 +118,22 @@ interface ModelItem {
|
|||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
isPrivate?: number;
|
isPrivate?: number;
|
||||||
isChatModel?: number;
|
isChatModel?: number;
|
||||||
headMsg?: string;
|
headMsg?: string | Record<string, string>;
|
||||||
operatorName?: string;
|
operatorName?: string;
|
||||||
responseBody?: Record<string, unknown>;
|
responseBody?: Record<string, unknown>;
|
||||||
|
responseTokenField?: string;
|
||||||
tokenConfig?: Record<string, unknown> | string;
|
tokenConfig?: Record<string, unknown> | string;
|
||||||
extendMapping?: Record<string, unknown> | string;
|
extendMapping?: Record<string, unknown> | string;
|
||||||
queryConfig?: Record<string, unknown>;
|
queryConfig?: Record<string, unknown>;
|
||||||
|
streamConfig?: Record<string, unknown>;
|
||||||
form?: ModelFormEntry[] | Record<string, unknown>;
|
form?: ModelFormEntry[] | Record<string, unknown>;
|
||||||
requestMapping?: Record<string, unknown>;
|
requestMapping?: Record<string, unknown>;
|
||||||
|
requiredFields?: string[];
|
||||||
|
firstFrame?: string;
|
||||||
|
lastFrame?: string;
|
||||||
responseMapping?: Record<string, unknown>;
|
responseMapping?: Record<string, unknown>;
|
||||||
|
callMode?: number;
|
||||||
|
isAsync?: number;
|
||||||
maxConcurrency?: number;
|
maxConcurrency?: number;
|
||||||
queueLimit?: number;
|
queueLimit?: number;
|
||||||
timeoutSeconds?: number;
|
timeoutSeconds?: number;
|
||||||
@@ -219,9 +226,28 @@ watch(
|
|||||||
|
|
||||||
const getModelTypeName = (type: number | string) => {
|
const getModelTypeName = (type: number | string) => {
|
||||||
const typeMap: Record<number, string> = {
|
const typeMap: Record<number, string> = {
|
||||||
1: '推理模型',
|
100: '推理模型',
|
||||||
2: '图片模型',
|
200: '图片模型',
|
||||||
3: '音频模型',
|
201: '图片模型-文生图',
|
||||||
|
202: '图片模型-图生图',
|
||||||
|
203: '图片模型-图片编辑',
|
||||||
|
204: '图片模型-图片变体',
|
||||||
|
300: '音频模型',
|
||||||
|
301: '音频模型-文生音',
|
||||||
|
302: '音频模型-音生文',
|
||||||
|
303: '音频模型-音生音',
|
||||||
|
400: '向量化模型',
|
||||||
|
401: '向量化模型-文本嵌入',
|
||||||
|
402: '向量化模型-重排序',
|
||||||
|
500: '全模态模型',
|
||||||
|
501: '全模态模型-文图音',
|
||||||
|
502: '全模态模型-视觉理解',
|
||||||
|
600: '视频模型',
|
||||||
|
601: '视频模型-文生视频',
|
||||||
|
602: '视频模型-图生视频',
|
||||||
|
603: '视频模型-图文生视频',
|
||||||
|
604: '视频模型-视频生视频',
|
||||||
|
605: '视频模型-视频编辑',
|
||||||
};
|
};
|
||||||
return typeMap[Number(type)] || '未知类型';
|
return typeMap[Number(type)] || '未知类型';
|
||||||
};
|
};
|
||||||
@@ -252,74 +278,71 @@ const fieldsToUnknownObject = (fields: Array<{ key: string; value: string }>) =>
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const flattenNestedObject = (obj: Record<string, unknown>, prefix = ''): Array<{ key: string; value: string }> => {
|
const parseFormEntries = (raw: unknown): ModelFormEntry[] => {
|
||||||
const rows: Array<{ key: string; value: string }> = [];
|
if (Array.isArray(raw)) {
|
||||||
Object.entries(obj || {}).forEach(([k, v]) => {
|
return (raw as ModelFormEntry[])
|
||||||
const fk = prefix ? `${prefix}.${k}` : k;
|
.filter((item) => item && item.key !== undefined)
|
||||||
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
.map((item) => ({
|
||||||
rows.push(...flattenNestedObject(v as Record<string, unknown>, fk));
|
key: String(item.key ?? '').trim(),
|
||||||
return;
|
value: String(item.value ?? ''),
|
||||||
}
|
}))
|
||||||
rows.push({ key: fk, value: String(v ?? '') });
|
.filter((item) => item.key !== '');
|
||||||
});
|
|
||||||
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: '' };
|
|
||||||
|
if (raw && typeof raw === 'object') {
|
||||||
|
return Object.entries(raw as Record<string, unknown>).map(([key, value]) => {
|
||||||
|
let nextValue = value;
|
||||||
|
if (nextValue && typeof nextValue === 'object' && !Array.isArray(nextValue) && 'value' in nextValue) {
|
||||||
|
nextValue = (nextValue as { value: unknown }).value;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
key: String(key).trim(),
|
||||||
|
value: String(nextValue ?? ''),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalizeQueryConfig = (raw: unknown): Record<string, unknown> => {
|
||||||
|
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
||||||
|
return raw as Record<string, unknown>;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseHeadMsgRecord = (raw: ModelItem['headMsg']) => {
|
||||||
|
const headMsgRecord: Record<string, string> = {};
|
||||||
|
if (typeof raw === 'string') {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(raw);
|
||||||
|
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
||||||
|
Object.entries(parsed).forEach(([k, v]) => {
|
||||||
|
headMsgRecord[k] = String(v);
|
||||||
|
});
|
||||||
|
return headMsgRecord;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
const pairs = raw.split(',');
|
||||||
|
pairs.forEach((pair) => {
|
||||||
|
const idx = pair.indexOf(':');
|
||||||
|
if (idx === -1) return;
|
||||||
|
const key = pair.slice(0, idx).trim();
|
||||||
|
const value = pair.slice(idx + 1).trim();
|
||||||
|
if (key) {
|
||||||
|
headMsgRecord[key] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return headMsgRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
||||||
|
Object.entries(raw).forEach(([k, v]) => {
|
||||||
|
headMsgRecord[k] = String(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return headMsgRecord;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchModelList = async () => {
|
const fetchModelList = async () => {
|
||||||
@@ -377,25 +400,25 @@ const handleCreatePrivateModel = async () => {
|
|||||||
creatingModel.value = true;
|
creatingModel.value = true;
|
||||||
|
|
||||||
const builtInModel = builtInModelToClone.value;
|
const builtInModel = builtInModelToClone.value;
|
||||||
const formList: ModelFormEntry[] = Array.isArray(builtInModel.form)
|
const formList = parseFormEntries(builtInModel.form);
|
||||||
? (builtInModel.form as ModelFormEntry[])
|
|
||||||
: Object.entries((builtInModel.form as Record<string, unknown>) || {}).map(([key, value]) => ({
|
|
||||||
key: String(key),
|
|
||||||
value: String(value ?? ''),
|
|
||||||
}));
|
|
||||||
const createParams: CreateModelParams = {
|
const createParams: CreateModelParams = {
|
||||||
modelName: apiKeyForm.modelName,
|
modelName: apiKeyForm.modelName,
|
||||||
modelType: builtInModel.modelType,
|
modelType: builtInModel.modelType,
|
||||||
operatorName: builtInModel.operatorName || '',
|
operatorName: builtInModel.operatorName || '',
|
||||||
baseUrl: builtInModel.baseUrl,
|
baseUrl: builtInModel.baseUrl,
|
||||||
httpMethod: builtInModel.httpMethod || 'POST',
|
httpMethod: builtInModel.httpMethod || 'POST',
|
||||||
headMsg: builtInModel.headMsg || '',
|
headMsg: parseHeadMsgRecord(builtInModel.headMsg),
|
||||||
isPrivate: builtInModel.isPrivate ?? 1,
|
isPrivate: builtInModel.isPrivate ?? 1,
|
||||||
enabled: builtInModel.enabled ?? 1,
|
enabled: builtInModel.enabled ?? 1,
|
||||||
isChatModel: builtInModel.isChatModel || 0,
|
isChatModel: builtInModel.isChatModel || 0,
|
||||||
|
callMode: builtInModel.callMode ?? builtInModel.isAsync ?? 0,
|
||||||
apiKey: apiKeyForm.apiKey,
|
apiKey: apiKeyForm.apiKey,
|
||||||
form: formList,
|
form: formList,
|
||||||
requestMapping: (builtInModel.requestMapping as Record<string, unknown>) || {},
|
requestMapping: (builtInModel.requestMapping as Record<string, unknown>) || {},
|
||||||
|
requiredFields: Array.isArray(builtInModel.requiredFields) ? builtInModel.requiredFields : [],
|
||||||
|
firstFrame: String(builtInModel.firstFrame || ''),
|
||||||
|
lastFrame: String(builtInModel.lastFrame || ''),
|
||||||
responseMapping: (builtInModel.responseMapping as Record<string, unknown>) || {},
|
responseMapping: (builtInModel.responseMapping as Record<string, unknown>) || {},
|
||||||
responseBody: builtInModel.responseBody || {},
|
responseBody: builtInModel.responseBody || {},
|
||||||
maxConcurrency: builtInModel.maxConcurrency || 10,
|
maxConcurrency: builtInModel.maxConcurrency || 10,
|
||||||
@@ -405,19 +428,20 @@ const handleCreatePrivateModel = async () => {
|
|||||||
retryTimes: builtInModel.retryTimes || 3,
|
retryTimes: builtInModel.retryTimes || 3,
|
||||||
retryQueueMaxSeconds: builtInModel.retryQueueMaxSeconds || 60,
|
retryQueueMaxSeconds: builtInModel.retryQueueMaxSeconds || 60,
|
||||||
autoCleanSeconds: builtInModel.autoCleanSeconds || 300,
|
autoCleanSeconds: builtInModel.autoCleanSeconds || 300,
|
||||||
remark: builtInModel.remark || '',
|
|
||||||
|
|
||||||
extendMapping: fieldsToUnknownObject(
|
extendMapping: fieldsToUnknownObject(
|
||||||
Object.entries(parseJsonObjectField(builtInModel.extendMapping)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
Object.entries(parseJsonObjectField(builtInModel.extendMapping)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
||||||
),
|
),
|
||||||
tokenConfig: fieldsToUnknownObject(
|
tokenConfig: fieldsToUnknownObject(
|
||||||
Object.entries(parseJsonObjectField(builtInModel.tokenConfig)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
Object.entries(parseJsonObjectField(builtInModel.tokenConfig)).map(([k, v]) => ({ key: k, value: String(v ?? '') }))
|
||||||
),
|
),
|
||||||
queryConfig: buildQueryConfigFromRaw(
|
queryConfig: normalizeQueryConfig(builtInModel.queryConfig),
|
||||||
builtInModel.queryConfig && typeof builtInModel.queryConfig === 'object' && !Array.isArray(builtInModel.queryConfig)
|
responseTokenField: String(builtInModel.responseTokenField || ''),
|
||||||
? (builtInModel.queryConfig as Record<string, unknown>)
|
streamConfig:
|
||||||
: null
|
Number(builtInModel.callMode ?? builtInModel.isAsync ?? 0) === 2
|
||||||
),
|
? builtInModel.streamConfig && typeof builtInModel.streamConfig === 'object' && !Array.isArray(builtInModel.streamConfig)
|
||||||
|
? (builtInModel.streamConfig as Record<string, unknown>)
|
||||||
|
: {}
|
||||||
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
const res: any = await addModelModule(createParams);
|
const res: any = await addModelModule(createParams);
|
||||||
|
|||||||
@@ -34,6 +34,23 @@ export const router = createRouter({
|
|||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes: staticRoutes,
|
routes: staticRoutes,
|
||||||
});
|
});
|
||||||
|
const hasValidResolvedRoute = (to: any) => {
|
||||||
|
const resolved = router.resolve(to.fullPath);
|
||||||
|
const matched = resolved.matched || [];
|
||||||
|
|
||||||
|
const isStaticFallbackRoute = matched.length === 1 && matched[0]?.path === '/:pathMatch(.*)*';
|
||||||
|
|
||||||
|
const isRedirectTo404Route = matched.length > 0 && matched.every((item) => item.redirect === '/404');
|
||||||
|
|
||||||
|
return matched.length > 0 && !isStaticFallbackRoute && !isRedirectTo404Route;
|
||||||
|
};
|
||||||
|
const goResolvedOr404AfterInit = (to: any, next: any) => {
|
||||||
|
if (hasValidResolvedRoute(to)) {
|
||||||
|
next({ ...to, replace: true });
|
||||||
|
} else {
|
||||||
|
next('/404');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由多级嵌套数组处理成一维数组
|
* 路由多级嵌套数组处理成一维数组
|
||||||
@@ -106,18 +123,18 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
const { routesList } = storeToRefs(storesRoutesList);
|
const { routesList } = storeToRefs(storesRoutesList);
|
||||||
if (routesList.value.length === 0) {
|
if (routesList.value.length === 0) {
|
||||||
if (isRequestRoutes) {
|
if (isRequestRoutes) {
|
||||||
// 后端控制路由:路由数据初始化,防止刷新时丢失
|
|
||||||
await initBackEndControlRoutes();
|
await initBackEndControlRoutes();
|
||||||
// 动态添加路由:防止非首页刷新时跳转回首页的问题
|
goResolvedOr404AfterInit(to, next);
|
||||||
// 确保 addRoute() 时动态添加的路由已经被完全加载上去
|
|
||||||
next({ ...to, replace: true });
|
|
||||||
} else {
|
} else {
|
||||||
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
|
|
||||||
await initFrontEndControlRoutes();
|
await initFrontEndControlRoutes();
|
||||||
next({ ...to, replace: true });
|
goResolvedOr404AfterInit(to, next);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next();
|
if (hasValidResolvedRoute(to)) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
next('/404');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由meta对象参数说明
|
* 路由meta对象参数说明
|
||||||
@@ -1077,8 +1077,8 @@ export const demoRoutes: Array<RouteRecordRaw> = [
|
|||||||
*/
|
*/
|
||||||
export const notFoundAndNoPower = [
|
export const notFoundAndNoPower = [
|
||||||
{
|
{
|
||||||
path: '/:path(.*)*',
|
path: '/404',
|
||||||
name: 'notFound',
|
name: 'notFoundPage',
|
||||||
component: () => import('/@/views/error/404.vue'),
|
component: () => import('/@/views/error/404.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'message.staticRoutes.notFound',
|
title: 'message.staticRoutes.notFound',
|
||||||
@@ -1094,6 +1094,15 @@ export const notFoundAndNoPower = [
|
|||||||
isHide: true,
|
isHide: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/:path(.*)*',
|
||||||
|
name: 'notFound',
|
||||||
|
redirect: '/404',
|
||||||
|
meta: {
|
||||||
|
title: 'message.staticRoutes.notFound',
|
||||||
|
isHide: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,22 +32,12 @@
|
|||||||
<div class="table-body">
|
<div class="table-body">
|
||||||
<div v-for="(attr, index) in ruleForm.attrs" :key="index" class="table-row">
|
<div v-for="(attr, index) in ruleForm.attrs" :key="index" class="table-row">
|
||||||
<div class="col col-name">
|
<div class="col col-name">
|
||||||
<el-input
|
<el-input v-if="!isDictType(attr.type)" v-model="attr.name" placeholder="请输入属性名称" clearable />
|
||||||
v-if="!isDictType(attr.type)"
|
|
||||||
v-model="attr.name"
|
|
||||||
placeholder="请输入属性名称"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
<span v-else class="dict-name">{{ attr.name || '请选择字典' }}</span>
|
<span v-else class="dict-name">{{ attr.name || '请选择字典' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-type">
|
<div class="col col-type">
|
||||||
<el-select v-model="attr.type" placeholder="属性类型" class="w100" @change="onAttrTypeChange(attr)">
|
<el-select v-model="attr.type" placeholder="属性类型" class="w100" @change="onAttrTypeChange(attr)">
|
||||||
<el-option
|
<el-option v-for="item in attrTypeOptions" :key="item.key" :label="item.value" :value="item.key" />
|
||||||
v-for="item in attrTypeOptions"
|
|
||||||
:key="item.key"
|
|
||||||
:label="item.value"
|
|
||||||
:value="item.key"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-required">
|
<div class="col col-required">
|
||||||
@@ -155,13 +145,6 @@ interface DictInfo {
|
|||||||
remark: string;
|
remark: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DictValue {
|
|
||||||
key: string;
|
|
||||||
value: string;
|
|
||||||
isDefault: number;
|
|
||||||
remark: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RuleForm {
|
interface RuleForm {
|
||||||
id: string | '';
|
id: string | '';
|
||||||
parentId: string;
|
parentId: string;
|
||||||
@@ -219,15 +202,11 @@ const fetchDictTypeOptions = () => {
|
|||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const list = res.data?.list ?? [];
|
const list = res.data?.list ?? [];
|
||||||
// 提取所有字典类型信息
|
// 提取所有字典类型信息
|
||||||
dictTypeOptions.value = list
|
dictTypeOptions.value = list.map((item: any) => item.info).filter((info: DictInfo) => info && info.name);
|
||||||
.map((item: any) => item.info)
|
|
||||||
.filter((info: DictInfo) => info && info.name);
|
|
||||||
// 保存完整的字典数据列表(包含info和values)
|
// 保存完整的字典数据列表(包含info和values)
|
||||||
dictValueOptions.value = list;
|
dictValueOptions.value = list;
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
|
|
||||||
dictTypeOptions.value = [];
|
dictTypeOptions.value = [];
|
||||||
dictValueOptions.value = [];
|
dictValueOptions.value = [];
|
||||||
})
|
})
|
||||||
@@ -270,7 +249,9 @@ const isDictOptionDisabled = (dictName: string, currentAttr: CustomAttr) => {
|
|||||||
const dictInfo = dictTypeOptions.value.find((item) => item.name === dictName);
|
const dictInfo = dictTypeOptions.value.find((item) => item.name === dictName);
|
||||||
const dictType = dictInfo?.type || '';
|
const dictType = dictInfo?.type || '';
|
||||||
// 检查该字典是否已被其他属性使用(使用 dictType 判断)
|
// 检查该字典是否已被其他属性使用(使用 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))
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加自定义属性
|
// 添加自定义属性
|
||||||
@@ -328,10 +309,10 @@ const openDialog = (row?: CategoryRow | string, edit?: boolean) => {
|
|||||||
|
|
||||||
// 递归函数,将所有id字段转换为字符串
|
// 递归函数,将所有id字段转换为字符串
|
||||||
const convertIdsToString = (items: any[]): any[] => {
|
const convertIdsToString = (items: any[]): any[] => {
|
||||||
return items.map(item => ({
|
return items.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
id: item.id?.toString(),
|
id: item.id?.toString(),
|
||||||
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : []
|
children: item.children && item.children.length > 0 ? convertIdsToString(item.children) : [],
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,18 +3,10 @@
|
|||||||
<div class="chat-divider">今天 15:14</div>
|
<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 v-for="msg in messages" :key="msg.id" class="message-row" :class="{ 'is-user': msg.isUser }">
|
||||||
<div v-if="!msg.isUser" class="avatar-wrap">
|
|
||||||
<div class="ai-avatar">AI</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bubble-wrap">
|
<div class="bubble-wrap">
|
||||||
<div class="bubble">{{ msg.content }}</div>
|
<div class="bubble">{{ msg.content }}</div>
|
||||||
<div class="time">{{ msg.time }}</div>
|
<div class="time">{{ msg.time }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="msg.isUser" class="avatar-wrap">
|
|
||||||
<el-avatar :size="28" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -64,16 +56,20 @@ const messages = ref<Message[]>([
|
|||||||
.chat-divider {
|
.chat-divider {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #8b95a7;
|
color: #64748b;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 0 12px;
|
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;
|
letter-spacing: 0.2px;
|
||||||
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-row {
|
.message-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-start;
|
||||||
gap: 10px;
|
gap: 12px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
||||||
&.is-user {
|
&.is-user {
|
||||||
@@ -81,27 +77,6 @@ const messages = ref<Message[]>([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-wrap {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ai-avatar {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 11px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #53607a;
|
|
||||||
background: linear-gradient(145deg, #f7f9fc 0%, #e9eef6 100%);
|
|
||||||
border: 1px solid #dfe6f0;
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bubble-wrap {
|
.bubble-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -112,30 +87,35 @@ const messages = ref<Message[]>([
|
|||||||
.bubble {
|
.bubble {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.75;
|
line-height: 1.75;
|
||||||
padding: 12px 14px;
|
padding: 14px 16px;
|
||||||
border-radius: 12px;
|
border-radius: 16px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
color: #1f2937;
|
color: #1f2937;
|
||||||
background: rgba(255, 255, 255, 0.84);
|
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);
|
border: 1px solid rgba(226, 233, 244, 0.95);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
|
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
.message-row.is-user & {
|
.message-row.is-user & {
|
||||||
background: linear-gradient(135deg, #58a6ff 0%, #3b82f6 52%, #2563eb 100%);
|
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
|
||||||
border-color: rgba(59, 130, 246, 0.32);
|
border-color: rgba(59, 130, 246, 0.4);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 8px 20px rgba(37, 99, 235, 0.33);
|
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #8f9aae;
|
color: #8f9aae;
|
||||||
padding: 0 4px;
|
padding: 4px 6px;
|
||||||
|
|
||||||
.message-row.is-user & {
|
.message-row.is-user & {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
color: rgba(148, 163, 184, 0.9);
|
||||||
|
}
|
||||||
|
.message-row:not(.is-user) & {
|
||||||
|
padding-left: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,216 +1,373 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="input-shell">
|
<div class="input-shell">
|
||||||
<div class="input-card">
|
<div class="input-card" :class="{ 'is-focused': isFocused }">
|
||||||
|
<!-- 已选中状态标签栏 -->
|
||||||
|
<div v-if="selectedWorkflowId !== null || selectedSkill !== 'default'" class="selected-tags">
|
||||||
|
<div v-if="selectedWorkflowId !== null" class="selected-tag workflow-tag">
|
||||||
|
<el-icon><Promotion /></el-icon>
|
||||||
|
<span>{{ commonWorkflows.find((w) => w.id === selectedWorkflowId)?.name }}</span>
|
||||||
|
<el-icon class="tag-close" @click="selectedWorkflowId = null"><Close /></el-icon>
|
||||||
|
</div>
|
||||||
|
<div v-if="selectedSkill !== 'default'" class="selected-tag skill-tag">
|
||||||
|
<el-icon><MagicStick /></el-icon>
|
||||||
|
<span>{{ skillLabels[selectedSkill] }}</span>
|
||||||
|
<el-icon class="tag-close" @click="selectedSkill = 'default'"><Close /></el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 文本输入区 -->
|
||||||
<el-input
|
<el-input
|
||||||
v-model="message"
|
v-model="message"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rows="1"
|
:autosize="{ minRows: 1, maxRows: 6 }"
|
||||||
:autosize="{ minRows: 2, maxRows: 5 }"
|
placeholder="有什么想聊的?按 Enter 发送,Shift+Enter 换行"
|
||||||
placeholder="多说说你的偏好和要求,我会越用越懂你"
|
|
||||||
class="message-input"
|
class="message-input"
|
||||||
@keydown.enter.exact="handleSend"
|
@focus="isFocused = true"
|
||||||
|
@blur="isFocused = false"
|
||||||
|
@keydown.enter.exact.prevent="handleSend"
|
||||||
|
@keydown.enter.shift.exact="() => {}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 底部工具栏 -->
|
||||||
<div class="input-toolbar">
|
<div class="input-toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button circle class="tool-btn" @click="handleAttachment">
|
<!-- 上传附件 -->
|
||||||
<el-icon><Plus /></el-icon>
|
<button class="tool-icon-btn" title="上传文件" @click="handleAttachment">
|
||||||
</el-button>
|
<el-icon><Paperclip /></el-icon>
|
||||||
<el-dropdown trigger="click" @command="handleCommandSelect">
|
</button>
|
||||||
<el-button class="pill-btn">快捷指令</el-button>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item command="rewrite">帮我润色这段文案</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="summary">总结当前对话重点</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="todo">整理下一步 TODO</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
|
|
||||||
<el-dropdown trigger="click" @command="handleReplySelect">
|
<!-- 选择技能 -->
|
||||||
<el-button class="pill-btn">快捷回复</el-button>
|
<el-dropdown trigger="click" placement="top-start" @command="handleSkillSelect">
|
||||||
|
<button class="tool-icon-btn" :class="{ active: selectedSkill !== 'default' }" title="选择技能">
|
||||||
|
<el-icon><MagicStick /></el-icon>
|
||||||
|
<span class="tool-label">技能</span>
|
||||||
|
</button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item command="ok">收到,我马上处理</el-dropdown-item>
|
<el-dropdown-item command="default">
|
||||||
<el-dropdown-item command="confirm">这个方向可以,继续</el-dropdown-item>
|
<el-icon><CircleClose /></el-icon>不使用技能
|
||||||
<el-dropdown-item command="adjust">这个比例还要再调一下</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item divided 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>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="toolbar-right">
|
<div class="toolbar-right">
|
||||||
<el-button class="mode-btn">启动</el-button>
|
<span class="hint-text">Shift+Enter 换行</span>
|
||||||
<el-button circle class="send-btn" :disabled="!message.trim()" @click="handleSend">
|
<button class="send-btn" :disabled="!message.trim()" @click="handleSend">
|
||||||
<el-icon><Top /></el-icon>
|
<el-icon><Top /></el-icon>
|
||||||
</el-button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 快捷工作流胶囊(输入框下方) -->
|
||||||
|
<div v-if="commonWorkflows.length > 0" class="workflow-shortcuts">
|
||||||
|
<button
|
||||||
|
v-for="wf in commonWorkflows"
|
||||||
|
:key="wf.id"
|
||||||
|
class="shortcut-pill"
|
||||||
|
:class="{ active: selectedWorkflowId === wf.id }"
|
||||||
|
@click="toggleWorkflow(wf.id)"
|
||||||
|
>
|
||||||
|
<el-icon><Promotion /></el-icon>
|
||||||
|
{{ wf.name }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { Top, Plus } from '@element-plus/icons-vue';
|
import { Top, MagicStick, Promotion, Close, CircleClose, Paperclip } from '@element-plus/icons-vue';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'send', message: string): void;
|
(e: 'send', message: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Workflow {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
prefix: string;
|
||||||
|
}
|
||||||
|
|
||||||
const emit = defineEmits<Emits>();
|
const emit = defineEmits<Emits>();
|
||||||
const message = ref('');
|
const message = ref('');
|
||||||
|
const isFocused = ref(false);
|
||||||
|
const selectedSkill = ref('default');
|
||||||
|
const selectedWorkflowId = ref<number | null>(null);
|
||||||
|
|
||||||
const quickCommands: Record<string, string> = {
|
const skillLabels: Record<string, string> = {
|
||||||
rewrite: '请帮我润色下面这段内容,保持原意并提升表达质感:',
|
default: '选择技能',
|
||||||
summary: '请总结我们当前对话的重点,并给出 3 条执行建议。',
|
'code-review': '代码审查',
|
||||||
todo: '请把当前需求拆解成可执行的 TODO 列表。',
|
refactor: '代码重构',
|
||||||
|
writing: '内容写作',
|
||||||
};
|
};
|
||||||
|
|
||||||
const quickReplies: Record<string, string> = {
|
const skillPrefixes: Record<string, string> = {
|
||||||
ok: '收到,我马上处理。',
|
default: '',
|
||||||
confirm: '这个方向可以,继续。',
|
'code-review': '[技能:代码审查] 请帮我审查下面这段代码,找出潜在问题并给出改进建议:\n',
|
||||||
adjust: '这个比例还要再调一下。',
|
refactor: '[技能:代码重构] 请帮我重构下面这段代码,提升可读性和可维护性:\n',
|
||||||
|
writing: '[技能:内容写作] 请根据下面的需求帮我创作内容:\n',
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSend = (event?: KeyboardEvent) => {
|
const commonWorkflows: Workflow[] = [
|
||||||
if (event) event.preventDefault();
|
{ id: 1, name: '审查', prefix: '[工作流:审查] 完成后请自动生成单元测试:\n' },
|
||||||
|
{ id: 2, name: '文档再编码', prefix: '[工作流:文档再编码] 请先编写接口文档,再实现代码:\n' },
|
||||||
|
{ id: 3, name: '代码重构', prefix: '[工作流:代码重构] 请帮我重构这段代码:\n' },
|
||||||
|
{ id: 4, name: '需求分析', prefix: '[工作流:需求分析] 请帮我分析这个需求并拆解任务:\n' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleSend = () => {
|
||||||
const msg = message.value.trim();
|
const msg = message.value.trim();
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
emit('send', msg);
|
const skillPrefix = skillPrefixes[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 = '';
|
message.value = '';
|
||||||
|
selectedWorkflowId.value = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAttachment = () => {
|
const handleAttachment = () => {
|
||||||
ElMessage.info('附件上传功能开发中...');
|
ElMessage.info('附件上传功能开发中...');
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCommandSelect = (key: string | number | object) => {
|
const handleSkillSelect = (key: string | number | object | null) => {
|
||||||
const k = String(key);
|
selectedSkill.value = String(key ?? 'default');
|
||||||
message.value = quickCommands[k] || message.value;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReplySelect = (key: string | number | object) => {
|
const toggleWorkflow = (id: number) => {
|
||||||
const k = String(key);
|
selectedWorkflowId.value = selectedWorkflowId.value === id ? null : id;
|
||||||
message.value = quickReplies[k] || message.value;
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.input-shell {
|
.input-shell {
|
||||||
position: relative;
|
padding: 0 24px 24px;
|
||||||
z-index: 12;
|
|
||||||
margin-top: -20px;
|
|
||||||
padding: 0 0 50px;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-card {
|
.input-card {
|
||||||
width: min(1060px, 82%);
|
max-width: 860px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background:
|
background: #fff;
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.92) 100%),
|
border: 1.5px solid #e2e8f0;
|
||||||
radial-gradient(120% 180% at 0% 0%, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0) 38%);
|
border-radius: 16px;
|
||||||
border: 1px solid rgba(191, 219, 254, 0.62);
|
box-shadow: 0 2px 12px rgba(15, 23, 42, 0.07);
|
||||||
border-radius: 18px;
|
transition:
|
||||||
box-shadow:
|
border-color 0.2s,
|
||||||
0 20px 44px rgba(15, 23, 42, 0.14),
|
box-shadow 0.2s;
|
||||||
0 0 0 1px rgba(59, 130, 246, 0.09) inset,
|
overflow: hidden;
|
||||||
0 10px 24px rgba(37, 99, 235, 0.16);
|
|
||||||
padding: 14px 16px 12px;
|
&.is-focused {
|
||||||
backdrop-filter: blur(14px);
|
border-color: #93c5fd;
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 3px rgba(59, 130, 246, 0.12),
|
||||||
|
0 2px 12px rgba(15, 23, 42, 0.07);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 已选标签栏 */
|
||||||
|
.selected-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 10px 14px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 3px 8px 3px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.4;
|
||||||
|
|
||||||
|
&.workflow-tag {
|
||||||
|
background: #eff6ff;
|
||||||
|
color: #2563eb;
|
||||||
|
border: 1px solid #bfdbfe;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.skill-tag {
|
||||||
|
background: #f5f3ff;
|
||||||
|
color: #7c3aed;
|
||||||
|
border: 1px solid #ddd6fe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-close {
|
||||||
|
margin-left: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.6;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文本域 */
|
||||||
.message-input {
|
.message-input {
|
||||||
:deep(.el-textarea__inner) {
|
:deep(.el-textarea__inner) {
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
resize: none;
|
resize: none;
|
||||||
padding: 8px 6px 14px;
|
padding: 14px 16px 8px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 1.65;
|
line-height: 1.6;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
min-height: 50px;
|
min-height: 28px !important;
|
||||||
font-weight: 500;
|
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
color: #90a1b7;
|
color: #94a3b8;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 底部工具栏 */
|
||||||
.input-toolbar {
|
.input-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
padding: 6px 10px 10px 12px;
|
||||||
padding-top: 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-left,
|
.toolbar-left,
|
||||||
.toolbar-right {
|
.toolbar-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tool-btn {
|
.tool-icon-btn {
|
||||||
width: 30px;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
border: 1px solid #d9e4f5;
|
padding: 0 10px;
|
||||||
color: #5b6b84;
|
border: none;
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
|
border-radius: 8px;
|
||||||
box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
|
background: transparent;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.15s,
|
||||||
|
color 0.15s;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #2b4d8f;
|
background: #f1f5f9;
|
||||||
background: #f3f8ff;
|
color: #334155;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #eff6ff;
|
||||||
|
color: #2563eb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pill-btn {
|
.tool-label {
|
||||||
height: 30px;
|
|
||||||
padding: 0 12px;
|
|
||||||
border-radius: 999px;
|
|
||||||
border: 1px solid #dbe7f7;
|
|
||||||
color: #30435f;
|
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-btn {
|
.hint-text {
|
||||||
height: 30px;
|
font-size: 11px;
|
||||||
padding: 0 13px;
|
color: #cbd5e1;
|
||||||
border-radius: 999px;
|
margin-right: 6px;
|
||||||
border: 1px solid #dbe7f7;
|
user-select: none;
|
||||||
color: #30435f;
|
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: 0.2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-btn {
|
.send-btn {
|
||||||
width: 30px;
|
display: inline-flex;
|
||||||
height: 30px;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
border: none;
|
border: none;
|
||||||
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 55%, #2563eb 100%);
|
border-radius: 8px;
|
||||||
|
background: #2563eb;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-shadow: 0 6px 14px rgba(59, 130, 246, 0.4);
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.15s,
|
||||||
|
transform 0.1s,
|
||||||
|
opacity 0.15s;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
filter: brightness(1.06);
|
background: #1d4ed8;
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
opacity: 0.55;
|
background: #e2e8f0;
|
||||||
box-shadow: none;
|
color: #94a3b8;
|
||||||
background: #cbd5e1;
|
cursor: not-allowed;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 快捷工作流胶囊 */
|
||||||
|
.workflow-shortcuts {
|
||||||
|
max-width: 860px;
|
||||||
|
margin: 10px auto 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcut-pill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
height: 28px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(255, 255, 255, 0.7);
|
||||||
|
color: #475569;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
transition: all 0.15s;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #93c5fd;
|
||||||
|
color: #2563eb;
|
||||||
|
background: rgba(239, 246, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
border-color: #3b82f6;
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,31 +3,20 @@
|
|||||||
<div v-if="activeMenu !== 'chat'" class="content-header">
|
<div v-if="activeMenu !== 'chat'" class="content-header">
|
||||||
<h2 class="content-title">{{ currentTitle }}</h2>
|
<h2 class="content-title">{{ currentTitle }}</h2>
|
||||||
<div class="content-actions">
|
<div class="content-actions">
|
||||||
<el-button v-if="showAddButton" type="primary" size="small" @click="handleAdd">
|
|
||||||
<el-icon><Plus /></el-icon>
|
|
||||||
新建
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-body">
|
<div class="content-body">
|
||||||
<ChatList v-if="activeMenu === 'chat'" />
|
<div class="chat-container" v-if="activeMenu === 'chat'">
|
||||||
<DiaryList v-else-if="activeMenu === 'diary'" />
|
<ChatList />
|
||||||
<FileList v-else-if="activeMenu === 'files'" />
|
</div>
|
||||||
<CommandList v-else-if="activeMenu === 'commands'" />
|
|
||||||
<ReplyList v-else-if="activeMenu === 'replies'" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { Plus } from '@element-plus/icons-vue';
|
|
||||||
import ChatList from './ChatList.vue';
|
import ChatList from './ChatList.vue';
|
||||||
import DiaryList from './DiaryList.vue';
|
|
||||||
import FileList from './FileList.vue';
|
|
||||||
import CommandList from './CommandList.vue';
|
|
||||||
import ReplyList from './ReplyList.vue';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
activeMenu: string;
|
activeMenu: string;
|
||||||
@@ -37,19 +26,11 @@ const props = defineProps<Props>();
|
|||||||
|
|
||||||
const menuTitles: Record<string, string> = {
|
const menuTitles: Record<string, string> = {
|
||||||
chat: '对话',
|
chat: '对话',
|
||||||
diary: '我的日记',
|
models: '模型管理',
|
||||||
files: '文件管理',
|
creation: '内容创作',
|
||||||
commands: '快捷指令',
|
|
||||||
replies: '快捷回复',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentTitle = computed(() => menuTitles[props.activeMenu] || '首页');
|
const currentTitle = computed(() => menuTitles[props.activeMenu] || '首页');
|
||||||
|
|
||||||
const showAddButton = computed(() => ['diary', 'files', 'commands', 'replies'].includes(props.activeMenu));
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
|
||||||
console.log('新建:', props.activeMenu);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -97,17 +78,11 @@ const handleAdd = () => {
|
|||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 聊天界面的特殊样式
|
.chat-container {
|
||||||
&:has(.chat-list) {
|
width: min(1060px, 82%);
|
||||||
padding: 0 8% 130px;
|
margin: 0 auto;
|
||||||
display: block;
|
padding: 20px 0 130px;
|
||||||
}
|
|
||||||
|
|
||||||
// 其他列表的样式
|
|
||||||
&:not(:has(.chat-list)) {
|
|
||||||
padding: 20px 24px;
|
|
||||||
background: #f9fafb;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,250 +1,501 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<div class="sidebar-header">
|
<!-- 顶部品牌区 -->
|
||||||
<div class="brand-dot"></div>
|
<div class="sidebar-brand">
|
||||||
<div class="user-info">
|
<div class="brand-logo">
|
||||||
<el-avatar :size="42" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
|
<el-icon class="brand-icon"><ChatDotRound /></el-icon>
|
||||||
<div class="user-details">
|
<span class="brand-name">AI 助手</span>
|
||||||
<div class="user-name">助手</div>
|
</div>
|
||||||
<div class="user-status">在线</div>
|
<el-tooltip content="新建对话" placement="right">
|
||||||
|
<button class="new-chat-icon-btn" @click="handleNewChat">
|
||||||
|
<el-icon><EditPen /></el-icon>
|
||||||
|
</button>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tab 切换 -->
|
||||||
|
<div class="sidebar-tabs">
|
||||||
|
<button class="tab-btn" :class="{ active: activeTab === 'history' }" @click="activeTab = 'history'">
|
||||||
|
<el-icon><ChatLineRound /></el-icon>
|
||||||
|
对话记录
|
||||||
|
</button>
|
||||||
|
<button class="tab-btn" :class="{ active: activeTab === 'workspace' }" @click="activeTab = 'workspace'">
|
||||||
|
<el-icon><FolderOpened /></el-icon>
|
||||||
|
工作空间
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 对话记录面板 -->
|
||||||
|
<div v-show="activeTab === 'history'" class="panel">
|
||||||
|
<div v-if="historyList.length" class="panel-list">
|
||||||
|
<div
|
||||||
|
v-for="item in visibleHistory"
|
||||||
|
:key="item.id"
|
||||||
|
class="history-item"
|
||||||
|
:class="{ active: activeHistoryId === item.id }"
|
||||||
|
@click="handleSelectHistory(item.id)"
|
||||||
|
>
|
||||||
|
<el-icon class="item-icon"><ChatLineRound /></el-icon>
|
||||||
|
<div class="item-body">
|
||||||
|
<div class="item-title">{{ item.title }}</div>
|
||||||
|
<div class="item-time">{{ item.time }}</div>
|
||||||
|
</div>
|
||||||
|
<button class="item-del-btn" @click.stop="handleDeleteHistory(item.id)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<button v-if="historyShowCount < historyList.length" class="load-more-btn" @click="historyShowCount += HISTORY_PAGE">
|
||||||
|
<el-icon><ArrowDown /></el-icon>
|
||||||
|
展开更多 ({{ historyList.length - historyShowCount }} 条)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<el-button class="new-chat-btn" @click="handleNewChat">
|
<div v-else class="panel-empty">暂无对话记录</div>
|
||||||
<el-icon><Plus /></el-icon>
|
|
||||||
新增对话
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sidebar-menu">
|
<!-- 工作空间面板 -->
|
||||||
<div v-for="item in menuItems" :key="item.key" class="menu-item" :class="{ active: activeMenu === item.key }" @click="handleMenuClick(item)">
|
<div v-show="activeTab === 'workspace'" class="panel" v-loading="treeLoading">
|
||||||
<el-icon :size="18" class="menu-icon">
|
<el-empty v-if="!treeLoading && treeNodes.length === 0" :image-size="48" description="暂无内容" />
|
||||||
<component :is="item.icon" />
|
<div v-else class="panel-list">
|
||||||
</el-icon>
|
<div v-for="dateNode in visibleWorkspace" :key="dateNode.id" class="tree-date-group">
|
||||||
<span class="menu-label">{{ item.label }}</span>
|
<div class="tree-date-label">{{ dateNode.label }}</div>
|
||||||
<el-badge v-if="item.badge" :value="item.badge" class="menu-badge" />
|
<div v-for="flowNode in dateNode.children" :key="flowNode.id" class="tree-flow-group">
|
||||||
|
<div class="tree-flow-label">
|
||||||
|
<el-icon><Promotion /></el-icon>
|
||||||
|
<span>{{ flowNode.label }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="fileNode in flowNode.children" :key="fileNode.id" class="tree-file-item">
|
||||||
|
<el-icon class="file-type-icon">
|
||||||
|
<component :is="getFileIcon(fileNode.fileType)" />
|
||||||
|
</el-icon>
|
||||||
|
<span class="file-name">{{ fileNode.label }}</span>
|
||||||
|
<div v-if="fileNode.fileUrl" class="file-actions">
|
||||||
|
<button class="file-action-btn" @click.stop="handlePreviewNode(fileNode)">预览</button>
|
||||||
|
<button class="file-action-btn" @click.stop="handleDownloadNode(fileNode)">下载</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button v-if="workspaceShowCount < treeNodes.length" class="load-more-btn" @click="workspaceShowCount += WORKSPACE_PAGE">
|
||||||
|
<el-icon><ArrowDown /></el-icon>
|
||||||
|
展开更多 ({{ treeNodes.length - workspaceShowCount }} 条)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sidebar-footer">
|
|
||||||
<el-button text class="footer-btn" @click="handleSettings">
|
|
||||||
<el-icon><Setting /></el-icon>
|
|
||||||
设置
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Document, Folder, ChatDotRound, MagicStick, Cpu, VideoPlay, Setting, Plus } from '@element-plus/icons-vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { Delete, ChatDotRound, ChatLineRound, EditPen, ArrowDown, Promotion, Document, VideoPlay, Headset, Picture, FolderOpened } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
interface MenuItem {
|
interface TreeNode {
|
||||||
key: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
icon: any;
|
nodeType: string;
|
||||||
badge?: number;
|
children?: TreeNode[];
|
||||||
route?: string;
|
fileUrl?: string;
|
||||||
|
workflowId?: number | string;
|
||||||
|
fileType?: string;
|
||||||
|
sessionId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HistoryItem {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
time: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
activeMenu: string;
|
activeMenu: string;
|
||||||
|
activeHistoryId: number;
|
||||||
|
historyList: HistoryItem[];
|
||||||
|
treeNodes: TreeNode[];
|
||||||
|
treeLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'menu-change', key: string): void;
|
(e: 'menu-change', key: string): void;
|
||||||
(e: 'new-chat'): void;
|
(e: 'new-chat'): void;
|
||||||
|
(e: 'select-history', id: number): void;
|
||||||
|
(e: 'delete-history', id: number): void;
|
||||||
|
(e: 'preview-node', data: TreeNode): void;
|
||||||
|
(e: 'download-node', data: TreeNode): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
const emit = defineEmits<Emits>();
|
const emit = defineEmits<Emits>();
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const menuItems: MenuItem[] = [
|
const HISTORY_PAGE = 10;
|
||||||
{ key: 'chat', label: '对话', icon: ChatDotRound },
|
const WORKSPACE_PAGE = 5;
|
||||||
{ key: 'diary', label: '日记', icon: Document, badge: 3 },
|
|
||||||
{ key: 'files', label: '文件', icon: Folder },
|
|
||||||
{ key: 'skills', label: '技能管理', icon: MagicStick, route: '/settings/skill' },
|
|
||||||
{ key: 'models', label: '模型管理', icon: Cpu, route: '/settings/modelConfig/modelModule' },
|
|
||||||
{ key: 'creation', label: '内容创作', icon: VideoPlay, route: '/settings/creation' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleMenuClick = (item: MenuItem) => {
|
const activeTab = ref<'history' | 'workspace'>('history');
|
||||||
if (item.route) {
|
const historyShowCount = ref(HISTORY_PAGE);
|
||||||
router.push(item.route);
|
const workspaceShowCount = ref(WORKSPACE_PAGE);
|
||||||
} else {
|
|
||||||
emit('menu-change', item.key);
|
const visibleHistory = computed(() => props.historyList.slice(0, historyShowCount.value));
|
||||||
}
|
const visibleWorkspace = computed(() => props.treeNodes.slice(0, workspaceShowCount.value));
|
||||||
|
|
||||||
|
const getFileIcon = (fileType?: string) => {
|
||||||
|
if (!fileType) return Document;
|
||||||
|
const t = fileType.toLowerCase();
|
||||||
|
if (t.includes('image') || t.includes('png') || t.includes('jpg') || t.includes('gif')) return Picture;
|
||||||
|
if (t.includes('video') || t.includes('mp4') || t.includes('webm')) return VideoPlay;
|
||||||
|
if (t.includes('audio') || t.includes('mp3') || t.includes('wav')) return Headset;
|
||||||
|
return Document;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNewChat = () => {
|
const handleNewChat = () => emit('new-chat');
|
||||||
emit('new-chat');
|
const handleSelectHistory = (id: number) => emit('select-history', id);
|
||||||
};
|
const handleDeleteHistory = (id: number) => emit('delete-history', id);
|
||||||
|
const handlePreviewNode = (data: TreeNode) => emit('preview-node', data);
|
||||||
const handleSettings = () => {
|
const handleDownloadNode = (data: TreeNode) => emit('download-node', data);
|
||||||
router.push('/personal');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 252px;
|
width: 240px;
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
|
flex-shrink: 0;
|
||||||
border-right: 1px solid #e7edf7;
|
background: #f8fafc;
|
||||||
|
border-right: 1px solid #e2e8f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
box-shadow: 6px 0 20px rgba(15, 23, 42, 0.04);
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header {
|
/* 品牌区 */
|
||||||
padding: 18px 16px 14px;
|
.sidebar-brand {
|
||||||
border-bottom: 1px solid #e9eef7;
|
display: flex;
|
||||||
position: relative;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 16px 12px 12px;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.new-chat-btn {
|
.brand-logo {
|
||||||
margin-top: 10px;
|
display: flex;
|
||||||
width: 100%;
|
align-items: center;
|
||||||
height: 34px;
|
gap: 8px;
|
||||||
border-radius: 10px;
|
}
|
||||||
border: 1px solid #dbe7f7;
|
|
||||||
background: linear-gradient(135deg, #f8fbff 0%, #eff6ff 100%);
|
.brand-icon {
|
||||||
color: #1f4db8;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
color: #2563eb;
|
||||||
letter-spacing: 0.2px;
|
}
|
||||||
|
|
||||||
|
.brand-name {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
|
letter-spacing: -0.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-chat-icon-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
color: #64748b;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #1e40af;
|
background: #e2e8f0;
|
||||||
border-color: #bfdbfe;
|
color: #0f172a;
|
||||||
background: linear-gradient(135deg, #eff6ff 0%, #e0eeff 100%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-dot {
|
/* Tab 切换 */
|
||||||
position: absolute;
|
.sidebar-tabs {
|
||||||
right: 16px;
|
|
||||||
top: 18px;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
|
|
||||||
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
padding: 8px 8px 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-btn {
|
||||||
|
flex: 1;
|
||||||
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
justify-content: center;
|
||||||
padding: 8px 8px 6px;
|
gap: 5px;
|
||||||
border-radius: 12px;
|
height: 34px;
|
||||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(248, 251, 255, 0.92) 100%);
|
border: none;
|
||||||
border: 1px solid #e7edf7;
|
border-radius: 8px 8px 0 0;
|
||||||
}
|
background: transparent;
|
||||||
|
color: #64748b;
|
||||||
.user-details {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-name {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #111827;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
letter-spacing: 0.2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-status {
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #10b981;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, color 0.15s;
|
||||||
|
outline: none;
|
||||||
|
border-bottom: 2px solid transparent;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover:not(.active) {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: #334155;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: #2563eb;
|
||||||
|
font-weight: 600;
|
||||||
|
background: #fff;
|
||||||
|
border-bottom-color: #2563eb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-menu {
|
/* 面板通用 */
|
||||||
|
.panel {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 12px 10px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
padding: 8px 8px 12px;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
-ms-overflow-style: none;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
.panel-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-empty {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #cbd5e1;
|
||||||
|
text-align: center;
|
||||||
|
padding: 32px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 历史记录条目 */
|
||||||
|
.history-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 8px;
|
||||||
padding: 11px 12px;
|
padding: 8px;
|
||||||
margin-bottom: 6px;
|
border-radius: 8px;
|
||||||
border-radius: 11px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.22s ease;
|
transition: background 0.15s;
|
||||||
color: #64748b;
|
margin-bottom: 1px;
|
||||||
position: relative;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #f3f7ff;
|
background: #f1f5f9;
|
||||||
color: #1f2937;
|
|
||||||
border-color: #e3ecfb;
|
.item-del-btn {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: linear-gradient(135deg, rgba(59, 130, 246, 0.16) 0%, rgba(37, 99, 235, 0.12) 100%);
|
background: #eff6ff;
|
||||||
color: #1f4db8;
|
|
||||||
font-weight: 600;
|
|
||||||
border-color: rgba(59, 130, 246, 0.2);
|
|
||||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
|
|
||||||
|
|
||||||
&::before {
|
.item-icon {
|
||||||
content: '';
|
color: #2563eb;
|
||||||
position: absolute;
|
}
|
||||||
left: -2px;
|
|
||||||
top: 50%;
|
.item-title {
|
||||||
transform: translateY(-50%);
|
color: #1d4ed8;
|
||||||
width: 3px;
|
font-weight: 600;
|
||||||
height: 18px;
|
|
||||||
background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
|
|
||||||
border-radius: 0 4px 4px 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-icon {
|
.item-icon {
|
||||||
opacity: 0.92;
|
font-size: 14px;
|
||||||
|
color: #94a3b8;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-label {
|
.item-body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 13px;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-badge {
|
.item-title {
|
||||||
:deep(.el-badge__content) {
|
font-size: 13px;
|
||||||
background: #ef4444;
|
font-weight: 500;
|
||||||
border: none;
|
color: #1e293b;
|
||||||
box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-time {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #94a3b8;
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-del-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
background: transparent;
|
||||||
|
color: #94a3b8;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s, background 0.15s, color 0.15s;
|
||||||
|
flex-shrink: 0;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #ef4444;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-footer {
|
/* 展开更多按钮 */
|
||||||
padding: 10px;
|
.load-more-btn {
|
||||||
border-top: 1px solid #e9eef7;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
.footer-btn {
|
gap: 5px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: flex-start;
|
height: 32px;
|
||||||
gap: 8px;
|
margin-top: 4px;
|
||||||
|
border: 1px dashed #cbd5e1;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
border-radius: 10px;
|
cursor: pointer;
|
||||||
padding: 10px 12px;
|
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #f4f7fd;
|
border-color: #93c5fd;
|
||||||
color: #1f2937;
|
color: #2563eb;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 工作空间树节点 */
|
||||||
|
.tree-date-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-date-label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #94a3b8;
|
||||||
|
padding: 6px 4px 2px;
|
||||||
|
letter-spacing: 0.4px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-flow-group {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-flow-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 6px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #475569;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #7c3aed;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-file-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 8px 5px 24px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f1f5f9;
|
||||||
|
|
||||||
|
.file-actions {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-type-icon {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #64748b;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-name {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #334155;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-action-btn {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #3b82f6;
|
||||||
|
font-size: 11px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 2px 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
outline: none;
|
||||||
|
transition: background 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #dbeafe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,56 +1,49 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="home-chat-container">
|
<div class="home-chat-container">
|
||||||
<Sidebar :active-menu="activeMenu" @menu-change="handleMenuChange" @new-chat="handleCreateHistory" />
|
<Sidebar
|
||||||
|
:active-menu="activeMenu"
|
||||||
|
:active-history-id="activeHistoryId"
|
||||||
|
:history-list="historyList"
|
||||||
|
:tree-nodes="treeNodes"
|
||||||
|
:tree-loading="treeLoading"
|
||||||
|
@menu-change="handleMenuChange"
|
||||||
|
@new-chat="handleCreateHistory"
|
||||||
|
@select-history="handleSelectHistory"
|
||||||
|
@delete-history="handleDeleteHistory"
|
||||||
|
@preview-node="previewNode"
|
||||||
|
@download-node="downloadNode"
|
||||||
|
/>
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
<MainContent :active-menu="activeMenu" />
|
<MainContent :active-menu="activeMenu" />
|
||||||
<InputBar @send="handleSend" />
|
<InputBar @send="handleSend" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="history-float" @click="historyDrawerVisible = true">
|
<!-- 预览弹窗 -->
|
||||||
<el-icon :size="16"><Clock /></el-icon>
|
<el-dialog v-model="previewDialogVisible" title="预览" width="95%" top="2vh" :close-on-click-modal="false" destroy-on-close>
|
||||||
<span>历史对话</span>
|
<div class="preview-container">
|
||||||
<em>{{ historyList.length }}</em>
|
<el-image v-if="previewUrl && previewMode === 'image'" :src="previewUrl" fit="contain" style="width: 100%; height: 100%" />
|
||||||
</div>
|
<video
|
||||||
|
v-else-if="previewUrl && previewMode === 'video'"
|
||||||
<el-drawer v-model="historyDrawerVisible" direction="rtl" :with-header="false" size="360px" class="history-drawer">
|
:src="previewUrl"
|
||||||
<div class="drawer-panel">
|
controls
|
||||||
<div class="drawer-header">
|
style="width: 100%; height: 100%; background: #000"
|
||||||
<div class="drawer-title">历史对话</div>
|
></video>
|
||||||
<el-button type="primary" class="new-btn" @click="handleCreateHistory">
|
<audio v-else-if="previewUrl && previewMode === 'audio'" :src="previewUrl" controls style="width: 100%"></audio>
|
||||||
<el-icon><Plus /></el-icon>
|
<iframe v-else-if="previewUrl" :src="previewUrl" class="preview-iframe" frameborder="0"></iframe>
|
||||||
新建会话
|
<el-empty v-else description="无法加载预览内容" />
|
||||||
</el-button>
|
|
||||||
</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-title">{{ item.title }}</div>
|
|
||||||
<div class="history-meta">{{ 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>
|
||||||
</el-drawer>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { Clock, Plus, Delete } from '@element-plus/icons-vue';
|
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import Sidebar from './components/Sidebar.vue';
|
import Sidebar from './components/Sidebar.vue';
|
||||||
import MainContent from './components/MainContent.vue';
|
import MainContent from './components/MainContent.vue';
|
||||||
import InputBar from './components/InputBar.vue';
|
import InputBar from './components/InputBar.vue';
|
||||||
|
import type { ExecutionTreeItem } from '/@/api/settings/creation';
|
||||||
|
import { getExecutionList } from '/@/api/settings/creation';
|
||||||
|
|
||||||
interface HistoryItem {
|
interface HistoryItem {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -58,9 +51,25 @@ interface HistoryItem {
|
|||||||
time: string;
|
time: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface TreeNode {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
nodeType: string;
|
||||||
|
children?: TreeNode[];
|
||||||
|
fileUrl?: string;
|
||||||
|
workflowId?: number | string;
|
||||||
|
fileType?: string;
|
||||||
|
sessionId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const activeMenu = ref('chat');
|
const activeMenu = ref('chat');
|
||||||
const historyDrawerVisible = ref(false);
|
|
||||||
const activeHistoryId = ref(1);
|
const activeHistoryId = ref(1);
|
||||||
|
const treeLoading = ref(false);
|
||||||
|
const treeNodes = ref<TreeNode[]>([]);
|
||||||
|
const imgAddressPrefix = ref('');
|
||||||
|
const previewDialogVisible = ref(false);
|
||||||
|
const previewUrl = ref('');
|
||||||
|
const previewMode = ref<'iframe' | 'image' | 'video' | 'audio'>('iframe');
|
||||||
|
|
||||||
const historyList = ref<HistoryItem[]>([
|
const historyList = ref<HistoryItem[]>([
|
||||||
{ id: 1, title: '首页风格优化方案', time: '刚刚' },
|
{ id: 1, title: '首页风格优化方案', time: '刚刚' },
|
||||||
@@ -69,6 +78,128 @@ const historyList = ref<HistoryItem[]>([
|
|||||||
{ id: 4, title: '快捷回复产品设计', time: '2 天前' },
|
{ id: 4, title: '快捷回复产品设计', time: '2 天前' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const apiBaseUrl = (import.meta.env.VITE_API_URL || '').replace(/\/$/, '');
|
||||||
|
|
||||||
|
const joinUrl = (b: string, p: string) => `${b.replace(/\/$/, '')}${p.startsWith('/') ? p : `/${p}`}`;
|
||||||
|
const buildAssetUrl = (p?: string) =>
|
||||||
|
!p
|
||||||
|
? ''
|
||||||
|
: /^https?:\/\//i.test(p)
|
||||||
|
? p
|
||||||
|
: /^https?:\/\//i.test(imgAddressPrefix.value || '')
|
||||||
|
? joinUrl(imgAddressPrefix.value, p)
|
||||||
|
: imgAddressPrefix.value
|
||||||
|
? joinUrl(joinUrl(apiBaseUrl, imgAddressPrefix.value), p)
|
||||||
|
: joinUrl(apiBaseUrl, p);
|
||||||
|
|
||||||
|
const buildTreeNodes = (tree: ExecutionTreeItem[]): TreeNode[] =>
|
||||||
|
tree.map((d, di) => ({
|
||||||
|
id: `date-${di}`,
|
||||||
|
label: d.createDate,
|
||||||
|
nodeType: 'date',
|
||||||
|
children: (d.flows || []).map((f, fi) => ({
|
||||||
|
id: `flow-${di}-${fi}`,
|
||||||
|
label: f.flowName || '未命名工作流',
|
||||||
|
nodeType: 'contentType',
|
||||||
|
workflowId: f.Id,
|
||||||
|
sessionId: f.sessionId,
|
||||||
|
children: (f.items || []).map((item, ii) => ({
|
||||||
|
id: `item-${di}-${fi}-${ii}`,
|
||||||
|
label: item.label || `作品${ii + 1}`,
|
||||||
|
nodeType: 'title',
|
||||||
|
fileUrl: item.content,
|
||||||
|
fileType: item.type,
|
||||||
|
workflowId: f.Id,
|
||||||
|
sessionId: f.sessionId,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 模拟mock数据
|
||||||
|
const mockTreeData: ExecutionTreeItem[] = [
|
||||||
|
{
|
||||||
|
createDate: '今天',
|
||||||
|
flows: [
|
||||||
|
{
|
||||||
|
Id: 1,
|
||||||
|
flowName: '代码审查任务',
|
||||||
|
sessionId: 'session-1',
|
||||||
|
items: [
|
||||||
|
{ label: '审查结果.md', content: 'https://placekitten.com/800/600', type: 'text/markdown', timestamp: '' },
|
||||||
|
{ label: '流程图.png', content: 'https://placekitten.com/800/600', type: 'image/png', timestamp: '' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Id: 2,
|
||||||
|
flowName: '需求分析',
|
||||||
|
sessionId: 'session-2',
|
||||||
|
items: [{ label: '需求拆解.txt', content: '# 需求分析结果\n\n- 功能点一\n- 功能点二\n- 需要优化', type: 'text/plain', timestamp: '' }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
createDate: '昨天',
|
||||||
|
flows: [
|
||||||
|
{
|
||||||
|
Id: 3,
|
||||||
|
flowName: '生成演示视频',
|
||||||
|
sessionId: 'session-3',
|
||||||
|
items: [{ label: '输出视频.mp4', content: 'https://www.w3schools.com/html/mov_bbb.mp4', type: 'video/mp4', timestamp: '' }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
treeLoading.value = true;
|
||||||
|
try {
|
||||||
|
const res = await getExecutionList();
|
||||||
|
imgAddressPrefix.value = res.data?.imgAddressPrefix || '';
|
||||||
|
const data = res.data?.tree || [];
|
||||||
|
// 如果后端没有数据,使用mock数据展示
|
||||||
|
treeNodes.value = data.length > 0 ? buildTreeNodes(data) : buildTreeNodes(mockTreeData);
|
||||||
|
} catch {
|
||||||
|
// 出错时使用mock数据展示
|
||||||
|
treeNodes.value = buildTreeNodes(mockTreeData);
|
||||||
|
imgAddressPrefix.value = '';
|
||||||
|
} finally {
|
||||||
|
treeLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getPreviewMode = (fileType?: string): 'image' | 'video' | 'audio' | 'iframe' => {
|
||||||
|
if (!fileType) return 'iframe';
|
||||||
|
const lower = fileType.toLowerCase();
|
||||||
|
if (lower.includes('image') || lower.includes('jpg') || lower.includes('png') || lower.includes('gif')) {
|
||||||
|
return 'image';
|
||||||
|
}
|
||||||
|
if (lower.includes('video') || lower.includes('mp4') || lower.includes('webm')) {
|
||||||
|
return 'video';
|
||||||
|
}
|
||||||
|
if (lower.includes('audio') || lower.includes('mp3') || lower.includes('wav')) {
|
||||||
|
return 'audio';
|
||||||
|
}
|
||||||
|
return 'iframe';
|
||||||
|
};
|
||||||
|
|
||||||
|
const previewNode = (data: TreeNode) => {
|
||||||
|
if (!data.fileUrl) return;
|
||||||
|
previewUrl.value = buildAssetUrl(data.fileUrl);
|
||||||
|
previewMode.value = getPreviewMode(data.fileType);
|
||||||
|
previewDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const downloadNode = (data: TreeNode) => {
|
||||||
|
if (!data.fileUrl) return;
|
||||||
|
const url = buildAssetUrl(data.fileUrl);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = data.label;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
};
|
||||||
|
|
||||||
const handleMenuChange = (menu: string) => {
|
const handleMenuChange = (menu: string) => {
|
||||||
activeMenu.value = menu;
|
activeMenu.value = menu;
|
||||||
};
|
};
|
||||||
@@ -104,6 +235,10 @@ const handleDeleteHistory = (id: number) => {
|
|||||||
}
|
}
|
||||||
ElMessage.success('已删除会话');
|
ElMessage.success('已删除会话');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@@ -116,8 +251,11 @@ const handleDeleteHistory = (id: number) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background:
|
background:
|
||||||
radial-gradient(1200px 460px at 65% -140px, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0) 68%),
|
radial-gradient(1200px 600px at 0% 0%, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0) 45%),
|
||||||
linear-gradient(180deg, #f7faff 0%, #f4f7fc 100%);
|
radial-gradient(1000px 500px at 100% 0%, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0) 50%),
|
||||||
|
radial-gradient(800px 400px at 0% 100%, rgba(236, 72, 153, 0.12) 0%, rgba(236, 72, 153, 0) 55%),
|
||||||
|
radial-gradient(600px 300px at 100% 100%, rgba(16, 185, 129, 0.10) 0%, rgba(16, 185, 129, 0) 60%),
|
||||||
|
linear-gradient(135deg, #f8fbff 0%, #e6f0ff 60%, #f0f4fa 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
.main-wrapper {
|
||||||
@@ -134,141 +272,18 @@ const handleDeleteHistory = (id: number) => {
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
background:
|
background:
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 28%),
|
linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 32%),
|
||||||
radial-gradient(1000px 380px at 10% 110%, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 72%);
|
radial-gradient(900px 360px at 15% 115%, rgba(99, 102, 241, 0.06) 0%, rgba(99, 102, 241, 0) 70%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-float {
|
.preview-container {
|
||||||
position: fixed;
|
max-height: 85vh;
|
||||||
right: 18px;
|
overflow: auto;
|
||||||
top: 52%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
z-index: 30;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 10px 12px;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
color: #1e3a8a;
|
|
||||||
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 246, 255, 0.96) 100%);
|
|
||||||
border: 1px solid #dbeafe;
|
|
||||||
box-shadow: 0 10px 24px rgba(30, 64, 175, 0.16);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
user-select: none;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
transform: translateY(-50%) translateX(-2px);
|
|
||||||
box-shadow: 0 14px 30px rgba(30, 64, 175, 0.22);
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: 0.2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
em {
|
|
||||||
height: 18px;
|
|
||||||
padding: 0 6px;
|
|
||||||
border-radius: 999px;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 18px;
|
|
||||||
color: #fff;
|
|
||||||
background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.history-drawer .el-drawer) {
|
.preview-iframe {
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
|
width: 100%;
|
||||||
}
|
min-height: 60vh;
|
||||||
|
|
||||||
.drawer-panel {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 16px 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drawer-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drawer-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.new-btn {
|
|
||||||
height: 32px;
|
|
||||||
padding: 0 12px;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-list {
|
|
||||||
flex: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 10px 10px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid #e6eef9;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: #cfe0fb;
|
|
||||||
background: #f5f9ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
border-color: #bcd5fa;
|
|
||||||
background: linear-gradient(135deg, rgba(219, 234, 254, 0.8) 0%, rgba(239, 246, 255, 0.9) 100%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-main {
|
|
||||||
min-width: 0;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-title {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #334155;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-meta {
|
|
||||||
font-size: 11px;
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.delete-btn {
|
|
||||||
opacity: 0;
|
|
||||||
color: #94a3b8;
|
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-item:hover .delete-btn {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,62 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="isEdit ? '编辑数据集' : '新增数据集'" v-model="isShowDialog" width="600px" :close-on-click-modal="false" @close="onCancel">
|
<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-form ref="formRef" :model="ruleForm" :rules="rules" label-width="100px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="数据集名称" prop="name">
|
<el-form-item label="数据集名称" prop="name">
|
||||||
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
|
<el-input v-model="ruleForm.name" placeholder="请输入数据集名称" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="数据集类型" prop="type">
|
<el-form-item label="数据集类型" prop="datasetType">
|
||||||
<el-select v-model="ruleForm.type" placeholder="请选择类型" clearable style="width: 100%">
|
<el-select v-model="ruleForm.datasetType" placeholder="请选择类型" clearable style="width: 100%">
|
||||||
<el-option label="文本" value="text" />
|
<el-option label="文本" :value="1" />
|
||||||
<el-option label="问答" value="qa" />
|
<el-option label="视频" :value="2" />
|
||||||
<el-option label="表格" value="table" />
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
<el-col :span="12">
|
||||||
<el-col :span="12">
|
<el-form-item label="向量模型" prop="embeddingModel">
|
||||||
<el-form-item label="向量模型" prop="embeddingModel">
|
<el-select v-model="ruleForm.embeddingModel" placeholder="请选择向量模型" clearable style="width: 100%">
|
||||||
<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-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-small" value="text-embedding-3-small" />
|
<el-option label="text-embedding-3-large" value="text-embedding-3-large" />
|
||||||
<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="bge-large-zh" value="bge-large-zh" />
|
<el-option label="m3e-base" value="m3e-base" />
|
||||||
<el-option label="m3e-base" value="m3e-base" />
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
</el-row>
|
||||||
</el-row>
|
<el-row :gutter="20">
|
||||||
<el-row :gutter="20">
|
<el-col :span="24">
|
||||||
<el-col :span="24">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-form-item label="描述" prop="description">
|
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
|
||||||
<el-input v-model="ruleForm.description" type="textarea" :rows="4" placeholder="请输入数据集描述" />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
</el-row>
|
||||||
</el-row>
|
<el-row :gutter="20" v-if="isEdit">
|
||||||
<el-row :gutter="20" v-if="isEdit">
|
<el-col :span="12">
|
||||||
<el-col :span="12">
|
<el-form-item label="文档数量">
|
||||||
<el-form-item label="文档数量">
|
<el-input :value="ruleForm.documentCount" disabled />
|
||||||
<el-input :value="ruleForm.documentCount" disabled />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
<el-col :span="12">
|
||||||
<el-col :span="12">
|
<el-form-item label="字符数量">
|
||||||
<el-form-item label="字符数量">
|
<el-input :value="ruleForm.charCount" disabled />
|
||||||
<el-input :value="ruleForm.charCount" disabled />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
</el-row>
|
||||||
</el-row>
|
</el-form>
|
||||||
</el-form>
|
<template #footer>
|
||||||
<template #footer>
|
<span class="dialog-footer">
|
||||||
<span class="dialog-footer">
|
<el-button @click="onCancel">取 消</el-button>
|
||||||
<el-button @click="onCancel">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
|
||||||
<el-button type="primary" @click="onSubmit" :loading="submitLoading">{{ isEdit ? '保 存' : '创 建' }}</el-button>
|
</span>
|
||||||
</span>
|
</template>
|
||||||
</template>
|
</el-dialog>
|
||||||
</el-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -86,7 +85,7 @@ const submitLoading = ref(false);
|
|||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
type: 'text',
|
datasetType: 1 as number,
|
||||||
description: '',
|
description: '',
|
||||||
embeddingModel: 'text-embedding-ada-002',
|
embeddingModel: 'text-embedding-ada-002',
|
||||||
documentCount: 0,
|
documentCount: 0,
|
||||||
@@ -96,7 +95,7 @@ const ruleForm = reactive({
|
|||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules = reactive<FormRules>({
|
const rules = reactive<FormRules>({
|
||||||
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
|
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
|
||||||
type: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
||||||
embeddingModel: [{ required: true, message: '请选择向量模型', trigger: 'change' }],
|
embeddingModel: [{ required: true, message: '请选择向量模型', trigger: 'change' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,7 +103,7 @@ const rules = reactive<FormRules>({
|
|||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
ruleForm.id = '';
|
ruleForm.id = '';
|
||||||
ruleForm.name = '';
|
ruleForm.name = '';
|
||||||
ruleForm.type = 'text';
|
ruleForm.datasetType = 1;
|
||||||
ruleForm.description = '';
|
ruleForm.description = '';
|
||||||
ruleForm.embeddingModel = 'text-embedding-ada-002';
|
ruleForm.embeddingModel = 'text-embedding-ada-002';
|
||||||
ruleForm.documentCount = 0;
|
ruleForm.documentCount = 0;
|
||||||
@@ -122,7 +121,7 @@ const openDialog = async (row?: any) => {
|
|||||||
const data = res.data || row;
|
const data = res.data || row;
|
||||||
ruleForm.id = data.id || '';
|
ruleForm.id = data.id || '';
|
||||||
ruleForm.name = data.name || '';
|
ruleForm.name = data.name || '';
|
||||||
ruleForm.type = data.type || 'text';
|
ruleForm.datasetType = data.datasetType || 1;
|
||||||
ruleForm.description = data.description || '';
|
ruleForm.description = data.description || '';
|
||||||
ruleForm.embeddingModel = data.embeddingModel || 'text-embedding-ada-002';
|
ruleForm.embeddingModel = data.embeddingModel || 'text-embedding-ada-002';
|
||||||
ruleForm.documentCount = data.documentCount || 0;
|
ruleForm.documentCount = data.documentCount || 0;
|
||||||
@@ -132,7 +131,7 @@ const openDialog = async (row?: any) => {
|
|||||||
// 使用传入的row数据
|
// 使用传入的row数据
|
||||||
ruleForm.id = row.id || '';
|
ruleForm.id = row.id || '';
|
||||||
ruleForm.name = row.name || '';
|
ruleForm.name = row.name || '';
|
||||||
ruleForm.type = row.type || 'text';
|
ruleForm.datasetType = row.datasetType || 1;
|
||||||
ruleForm.description = row.description || '';
|
ruleForm.description = row.description || '';
|
||||||
ruleForm.embeddingModel = row.embeddingModel || 'text-embedding-ada-002';
|
ruleForm.embeddingModel = row.embeddingModel || 'text-embedding-ada-002';
|
||||||
ruleForm.documentCount = row.documentCount || 0;
|
ruleForm.documentCount = row.documentCount || 0;
|
||||||
@@ -161,7 +160,7 @@ const onSubmit = async () => {
|
|||||||
const data = {
|
const data = {
|
||||||
id: ruleForm.id || undefined,
|
id: ruleForm.id || undefined,
|
||||||
name: ruleForm.name,
|
name: ruleForm.name,
|
||||||
type: ruleForm.type,
|
datasetType: ruleForm.datasetType,
|
||||||
description: ruleForm.description,
|
description: ruleForm.description,
|
||||||
embeddingModel: ruleForm.embeddingModel,
|
embeddingModel: ruleForm.embeddingModel,
|
||||||
status: 'enable',
|
status: 'enable',
|
||||||
|
|||||||
@@ -1,107 +1,106 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="knowledge-knowledge-page">
|
<div class="knowledge-knowledge-page">
|
||||||
<div class="knowledge-knowledge-container">
|
<div class="knowledge-knowledge-container">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<div class="knowledge-knowledge-search mb15">
|
<div class="knowledge-knowledge-search mb15">
|
||||||
<el-form :inline="true">
|
<el-form :inline="true">
|
||||||
<el-form-item label="数据集名称">
|
<el-form-item label="数据集名称">
|
||||||
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
|
<el-input size="default" v-model="tableData.param.keyword" placeholder="请输入数据集名称" clearable style="width: 200px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据集类型">
|
<el-form-item label="数据集类型">
|
||||||
<el-select size="default" v-model="tableData.param.type" placeholder="请选择类型" clearable style="width: 150px">
|
<el-select size="default" v-model="tableData.param.datasetType" placeholder="请选择类型" clearable style="width: 150px">
|
||||||
<el-option label="文本" value="text" />
|
<el-option label="文本" :value="1" />
|
||||||
<el-option label="问答" value="qa" />
|
<el-option label="视频" :value="2" />
|
||||||
<el-option label="表格" value="table" />
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="状态">
|
||||||
<el-form-item label="状态">
|
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
|
||||||
<el-select size="default" v-model="tableData.param.status" placeholder="请选择状态" clearable style="width: 120px">
|
<el-option label="启用" value="enable" />
|
||||||
<el-option label="启用" value="enable" />
|
<el-option label="禁用" value="disable" />
|
||||||
<el-option label="禁用" value="disable" />
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item>
|
||||||
<el-form-item>
|
<el-button size="default" type="primary" @click="getknowledgeList">
|
||||||
<el-button size="default" type="primary" @click="getknowledgeList">
|
<el-icon><ele-Search /></el-icon>
|
||||||
<el-icon><ele-Search /></el-icon>
|
查询
|
||||||
查询
|
</el-button>
|
||||||
</el-button>
|
<el-button size="default" @click="onResetQuery">
|
||||||
<el-button size="default" @click="onResetQuery">
|
<el-icon><ele-Refresh /></el-icon>
|
||||||
<el-icon><ele-Refresh /></el-icon>
|
重置
|
||||||
重置
|
</el-button>
|
||||||
</el-button>
|
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
|
||||||
<el-button size="default" type="success" @click="onOpenAdd" v-auth="'api/v1/knowledge/knowledge/create'">
|
<el-icon><ele-Plus /></el-icon>
|
||||||
<el-icon><ele-Plus /></el-icon>
|
新增
|
||||||
新增
|
</el-button>
|
||||||
</el-button>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-form>
|
||||||
</el-form>
|
</div>
|
||||||
</div>
|
<el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading" border>
|
||||||
<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 type="index" label="序号" width="60" align="center" />
|
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
|
||||||
<el-table-column prop="name" label="数据集名称" min-width="180" show-overflow-tooltip>
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
|
||||||
<el-link type="primary" @click="onViewDetail(scope.row)">{{ scope.row.name }}</el-link>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="datasetType" label="类型" width="100" align="center">
|
||||||
<el-table-column prop="type" label="类型" width="100" align="center">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-tag :type="getTypeTagType(scope.row.datasetType)">{{ getTypeText(scope.row.datasetType) }}</el-tag>
|
||||||
<el-tag :type="getTypeTagType(scope.row.type)">{{ getTypeText(scope.row.type) }}</el-tag>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
|
||||||
<el-table-column prop="documentCount" label="文档数" width="100" align="center" />
|
<el-table-column prop="charCount" label="字符数" width="120" align="center">
|
||||||
<el-table-column prop="charCount" label="字符数" width="120" align="center">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
{{ formatCharCount(scope.row.charCount) }}
|
||||||
{{ formatCharCount(scope.row.charCount) }}
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="embeddingModel" label="向量模型" width="150" show-overflow-tooltip />
|
<el-table-column prop="status" label="状态" width="80" align="center">
|
||||||
<el-table-column prop="status" label="状态" width="80" align="center">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-switch
|
||||||
<el-switch
|
v-model="scope.row.statusEnabled"
|
||||||
v-model="scope.row.statusEnabled"
|
inline-prompt
|
||||||
inline-prompt
|
active-text="启"
|
||||||
active-text="启"
|
inactive-text="停"
|
||||||
inactive-text="停"
|
@change="onStatusChange(scope.row)"
|
||||||
@change="onStatusChange(scope.row)"
|
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
|
||||||
v-auth="'api/v1/knowledge/knowledge/updateStatus'"
|
/>
|
||||||
/>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="createdAt" label="创建时间" width="170" show-overflow-tooltip />
|
||||||
<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 prop="updatedAt" label="更新时间" width="170" show-overflow-tooltip />
|
<el-table-column label="操作" width="200" fixed="right" align="center">
|
||||||
<el-table-column label="操作" width="200" fixed="right" align="center">
|
<template #default="scope">
|
||||||
<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="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="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>
|
||||||
<el-button size="small" text type="danger" @click="onRowDel(scope.row)" v-auth="'api/v1/knowledge/knowledge/delete'">删除</el-button>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table>
|
||||||
</el-table>
|
<!-- 分页 -->
|
||||||
<!-- 分页 -->
|
<div class="mt15" style="text-align: right">
|
||||||
<div class="mt15" style="text-align: right">
|
<el-pagination
|
||||||
<el-pagination
|
v-model:current-page="tableData.param.pageNum"
|
||||||
v-model:current-page="tableData.param.pageNum"
|
v-model:page-size="tableData.param.pageSize"
|
||||||
v-model:page-size="tableData.param.pageSize"
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
:page-sizes="[10, 20, 50, 100]"
|
:total="tableData.total"
|
||||||
:total="tableData.total"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
@size-change="onSizeChange"
|
||||||
@size-change="onSizeChange"
|
@current-change="onCurrentChange"
|
||||||
@current-change="onCurrentChange"
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
</el-card>
|
||||||
</el-card>
|
</div>
|
||||||
|
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
|
||||||
</div>
|
</div>
|
||||||
<Editknowledge ref="editknowledgeRef" @getknowledgeList="getknowledgeList" />
|
</template>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'knowledgeknowledge',
|
name: 'knowledgeknowledge',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
@@ -117,7 +116,7 @@ const tableData = reactive({
|
|||||||
loading: false,
|
loading: false,
|
||||||
param: {
|
param: {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
type: '',
|
datasetType: undefined as number | undefined,
|
||||||
status: undefined as string | undefined,
|
status: undefined as string | undefined,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -148,30 +147,26 @@ const getknowledgeList = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 获取类型标签类型
|
// 获取类型标签类型
|
||||||
const getTypeTagType = (type: string) => {
|
const getTypeTagType = (datasetType: number) => {
|
||||||
switch (type) {
|
switch (datasetType) {
|
||||||
case 'text':
|
case 1:
|
||||||
return 'primary';
|
return 'primary';
|
||||||
case 'qa':
|
case 2:
|
||||||
return 'success';
|
return 'success';
|
||||||
case 'table':
|
|
||||||
return 'warning';
|
|
||||||
default:
|
default:
|
||||||
return 'info';
|
return 'info';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取类型文本
|
// 获取类型文本
|
||||||
const getTypeText = (type: string) => {
|
const getTypeText = (datasetType: number) => {
|
||||||
switch (type) {
|
switch (datasetType) {
|
||||||
case 'text':
|
case 1:
|
||||||
return '文本';
|
return '文本';
|
||||||
case 'qa':
|
case 2:
|
||||||
return '问答';
|
return '视频';
|
||||||
case 'table':
|
|
||||||
return '表格';
|
|
||||||
default:
|
default:
|
||||||
return type;
|
return String(datasetType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -187,7 +182,7 @@ const formatCharCount = (count: number) => {
|
|||||||
// 重置查询
|
// 重置查询
|
||||||
const onResetQuery = () => {
|
const onResetQuery = () => {
|
||||||
tableData.param.keyword = '';
|
tableData.param.keyword = '';
|
||||||
tableData.param.type = '';
|
tableData.param.datasetType = undefined;
|
||||||
tableData.param.status = undefined;
|
tableData.param.status = undefined;
|
||||||
tableData.param.pageNum = 1;
|
tableData.param.pageNum = 1;
|
||||||
getknowledgeList();
|
getknowledgeList();
|
||||||
@@ -261,9 +256,9 @@ const onCurrentChange = (page: number) => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getknowledgeList();
|
getknowledgeList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.knowledge-knowledge-page {
|
.knowledge-knowledge-page {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
.knowledge-knowledge-container {
|
.knowledge-knowledge-container {
|
||||||
@@ -274,4 +269,4 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button text size="small" v-debounce @click="onPreviewFile(row)">预览</el-button>
|
<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 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 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>
|
<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-form-item label="名称" prop="name">
|
||||||
<el-input v-model="knowledgeForm.name" placeholder="请输入知识库名称" />
|
<el-input v-model="knowledgeForm.name" placeholder="请输入知识库名称" />
|
||||||
</el-form-item>
|
</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-form-item label="描述" prop="description">
|
||||||
<el-input v-model="knowledgeForm.description" type="textarea" :rows="3" placeholder="请输入描述" />
|
<el-input v-model="knowledgeForm.description" type="textarea" :rows="3" placeholder="请输入描述" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -469,10 +475,12 @@ const knowledgeFormRef = ref<FormInstance>();
|
|||||||
const knowledgeForm = reactive({
|
const knowledgeForm = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
datasetType: undefined as number | undefined,
|
||||||
description: '',
|
description: '',
|
||||||
});
|
});
|
||||||
const knowledgeRules = reactive<FormRules>({
|
const knowledgeRules = reactive<FormRules>({
|
||||||
name: [{ required: true, message: '请输入知识库名称', trigger: 'blur' }],
|
name: [{ required: true, message: '请输入知识库名称', trigger: 'blur' }],
|
||||||
|
datasetType: [{ required: true, message: '请选择数据集类型', trigger: 'change' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
// 文件列表(含OSS上传结果)
|
// 文件列表(含OSS上传结果)
|
||||||
@@ -555,6 +563,7 @@ const getknowledgeList = async () => {
|
|||||||
const response = await listknowledges({
|
const response = await listknowledges({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
|
datasetType: 1,
|
||||||
});
|
});
|
||||||
knowledgeList.value = response.data.list || [];
|
knowledgeList.value = response.data.list || [];
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
@@ -576,6 +585,7 @@ const onSelectknowledge = (item: any) => {
|
|||||||
const onAddknowledge = () => {
|
const onAddknowledge = () => {
|
||||||
knowledgeForm.id = '';
|
knowledgeForm.id = '';
|
||||||
knowledgeForm.name = '';
|
knowledgeForm.name = '';
|
||||||
|
knowledgeForm.datasetType = undefined;
|
||||||
knowledgeForm.description = '';
|
knowledgeForm.description = '';
|
||||||
showknowledgeDialog.value = true;
|
showknowledgeDialog.value = true;
|
||||||
};
|
};
|
||||||
@@ -594,6 +604,7 @@ const onCardContextMenu = (event: MouseEvent, item: any) => {
|
|||||||
const onRenameknowledge = (item: any) => {
|
const onRenameknowledge = (item: any) => {
|
||||||
knowledgeForm.id = item.id;
|
knowledgeForm.id = item.id;
|
||||||
knowledgeForm.name = item.name;
|
knowledgeForm.name = item.name;
|
||||||
|
knowledgeForm.datasetType = item.datasetType;
|
||||||
knowledgeForm.description = item.description || '';
|
knowledgeForm.description = item.description || '';
|
||||||
showknowledgeDialog.value = true;
|
showknowledgeDialog.value = true;
|
||||||
};
|
};
|
||||||
@@ -634,14 +645,17 @@ const onSaveknowledge = async () => {
|
|||||||
await updateknowledge({
|
await updateknowledge({
|
||||||
id: knowledgeForm.id,
|
id: knowledgeForm.id,
|
||||||
name: knowledgeForm.name,
|
name: knowledgeForm.name,
|
||||||
|
datasetType: knowledgeForm.datasetType,
|
||||||
description: knowledgeForm.description,
|
description: knowledgeForm.description,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 创建知识库
|
// 创建知识库
|
||||||
await createknowledge({
|
const params = {
|
||||||
name: knowledgeForm.name,
|
name: knowledgeForm.name,
|
||||||
|
datasetType: knowledgeForm.datasetType as number,
|
||||||
description: knowledgeForm.description,
|
description: knowledgeForm.description,
|
||||||
});
|
};
|
||||||
|
await createknowledge(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElMessage.success(knowledgeForm.id ? '保存成功' : '创建成功');
|
ElMessage.success(knowledgeForm.id ? '保存成功' : '创建成功');
|
||||||
@@ -988,7 +1002,7 @@ const onSaveModelConfig = async () => {
|
|||||||
// 构建请求数据,只传递接口需要的字段
|
// 构建请求数据,只传递接口需要的字段
|
||||||
const data = {
|
const data = {
|
||||||
modelType: selectedModelType.value,
|
modelType: selectedModelType.value,
|
||||||
configType: selectedConfigType.value,
|
configType: selectedConfigType,
|
||||||
modelName: modelFormData.value.modelName,
|
modelName: modelFormData.value.modelName,
|
||||||
modelDesc: modelFormData.value.modelDesc,
|
modelDesc: modelFormData.value.modelDesc,
|
||||||
configContent: {} as Record<string, any>,
|
configContent: {} as Record<string, any>,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default defineComponent({
|
|||||||
isShowPassword: false,
|
isShowPassword: false,
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: '123456',
|
password: 'Tongli686^*^',
|
||||||
verifyCode: '',
|
verifyCode: '',
|
||||||
verifyKey: '',
|
verifyKey: '',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,221 +1,540 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="cid-apis-container">
|
<div class="cid-apis-container">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover"
|
||||||
<div class="system-user-search mb15">
|
><el-tabs v-model="tab" @tab-change="onTab"
|
||||||
<el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="68px">
|
><el-tab-pane label="平台管理" name="platform"
|
||||||
<el-form-item label="关键字" prop="keyword">
|
><el-form ref="pqf" :model="pq" :inline="true" label-width="68px" class="mb15"
|
||||||
<el-input
|
><el-form-item label="关键字" prop="keyword"
|
||||||
v-model="tableData.param.keyword"
|
><el-input
|
||||||
placeholder="请输入接口名称"
|
v-model="pq.keyword"
|
||||||
clearable
|
placeholder="请输入平台名称/编码"
|
||||||
size="default"
|
clearable
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
@keyup.enter.native="getList"
|
@keyup.enter.native="searchPlatform" /></el-form-item
|
||||||
/>
|
><el-form-item label="状态" prop="status"
|
||||||
</el-form-item>
|
><el-select v-model="pq.status" placeholder="平台状态" clearable style="width: 160px"
|
||||||
<el-form-item>
|
><el-option label="启用" value="ACTIVE" /><el-option label="禁用" value="INACTIVE" /></el-select></el-form-item
|
||||||
<el-button size="default" type="primary" @click="getList">
|
><el-form-item
|
||||||
<el-icon><ele-Search /></el-icon>
|
><el-button type="primary" @click="searchPlatform"
|
||||||
查询
|
><el-icon><ele-Search /></el-icon>查询</el-button
|
||||||
</el-button>
|
><el-button @click="resetPlatformQuery"
|
||||||
<el-button size="default" @click="resetQuery(queryRef)">
|
><el-icon><ele-Refresh /></el-icon>重置</el-button
|
||||||
<el-icon><ele-Refresh /></el-icon>
|
><el-button type="success" @click="openPlatform()"
|
||||||
重置
|
><el-icon><ele-FolderAdd /></el-icon>新增平台</el-button
|
||||||
</el-button>
|
></el-form-item
|
||||||
<el-button size="default" type="success" @click="onOpenAdd">
|
></el-form
|
||||||
<el-icon><ele-FolderAdd /></el-icon>
|
><el-table :data="platformRows" row-key="id" v-loading="platformLoading"
|
||||||
新增接口
|
><el-table-column type="index" label="序号" width="60" /><el-table-column
|
||||||
</el-button>
|
prop="platformCode"
|
||||||
<el-button size="default" type="danger" @click="onRowDel(null)">
|
label="平台编码"
|
||||||
<el-icon><ele-Delete /></el-icon>
|
min-width="140"
|
||||||
删除
|
show-overflow-tooltip
|
||||||
</el-button>
|
/><el-table-column prop="platformName" label="平台名称" min-width="160" show-overflow-tooltip /><el-table-column
|
||||||
</el-form-item>
|
prop="apiBaseUrl"
|
||||||
</el-form>
|
label="API地址"
|
||||||
</div>
|
min-width="220"
|
||||||
<el-table :data="tableData.data" style="width: 100%" @selection-change="handleSelectionChange">
|
show-overflow-tooltip
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
/><el-table-column prop="authType" label="认证" width="100" align="center" /><el-table-column
|
||||||
<el-table-column type="index" label="序号" width="60" />
|
prop="status"
|
||||||
<el-table-column prop="name" label="接口名称" show-overflow-tooltip />
|
label="状态"
|
||||||
<el-table-column prop="path" label="接口路径" show-overflow-tooltip />
|
width="90"
|
||||||
<el-table-column prop="method" label="请求方式" width="100" align="center" />
|
align="center"
|
||||||
<el-table-column prop="datasourceName" label="所属平台" show-overflow-tooltip />
|
><template #default="s"
|
||||||
<el-table-column prop="status" label="状态" width="100" align="center">
|
><el-tag size="small" :type="s.row.status === 'ACTIVE' ? 'success' : 'danger'">{{
|
||||||
<template #default="scope">
|
s.row.status === 'ACTIVE' ? '启用' : '禁用'
|
||||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'" size="small">
|
}}</el-tag></template
|
||||||
{{ scope.row.status === 1 ? '启用' : '禁用' }}
|
></el-table-column
|
||||||
</el-tag>
|
><el-table-column prop="rateLimitPerMinute" label="限流/分钟" width="110" align="center" /><el-table-column
|
||||||
</template>
|
prop="requestTimeoutMs"
|
||||||
</el-table-column>
|
label="超时(ms)"
|
||||||
<el-table-column prop="createdAt" label="创建时间" show-overflow-tooltip />
|
width="110"
|
||||||
<el-table-column label="操作" width="180">
|
align="center"
|
||||||
<template #default="scope">
|
/><el-table-column label="创建时间" width="170"
|
||||||
<el-button size="small" text type="primary" @click="onOpenEdit(scope.row)">修改</el-button>
|
><template #default="s">{{ ft(s.row.createdAt) }}</template></el-table-column
|
||||||
<el-button size="small" text type="danger" @click="onRowDel(scope.row)">删除</el-button>
|
><el-table-column label="操作" width="150" fixed="right"
|
||||||
</template>
|
><template #default="s"
|
||||||
</el-table-column>
|
><el-button size="small" text type="primary" @click="openPlatform(s.row)">修改</el-button
|
||||||
</el-table>
|
><el-button size="small" text type="danger" @click="delPlatform(s.row)">删除</el-button></template
|
||||||
<pagination
|
></el-table-column
|
||||||
v-show="tableData.total > 0"
|
></el-table
|
||||||
:total="tableData.total"
|
><pagination :total="platformTotal" v-model:page="pq.pageNum" v-model:limit="pq.pageSize" @pagination="getPlatforms" /></el-tab-pane
|
||||||
v-model:page="tableData.param.pageNum"
|
><el-tab-pane label="接口管理" name="api"
|
||||||
v-model:limit="tableData.param.pageSize"
|
><el-form ref="aqf" :model="aq" :inline="true" label-width="68px" class="mb15"
|
||||||
@pagination="getList"
|
><el-form-item label="关键字" prop="keyword"
|
||||||
/>
|
><el-input
|
||||||
</el-card>
|
v-model="aq.keyword"
|
||||||
|
placeholder="请输入接口名称/编码"
|
||||||
<!-- 新增/编辑弹窗 -->
|
clearable
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" :close-on-click-modal="false">
|
style="width: 220px"
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="90px">
|
@keyup.enter.native="searchApi" /></el-form-item
|
||||||
<el-form-item label="接口名称" prop="name">
|
><el-form-item label="平台" prop="platformId"
|
||||||
<el-input v-model="form.name" placeholder="请输入接口名称" />
|
><el-select v-model="aq.platformId" placeholder="请选择平台" clearable filterable style="width: 180px"
|
||||||
</el-form-item>
|
><el-option v-for="i in platforms" :key="i.id" :label="i.platformName" :value="String(i.id)" /></el-select></el-form-item
|
||||||
<el-form-item label="接口路径" prop="path">
|
><el-form-item label="状态" prop="status"
|
||||||
<el-input v-model="form.path" placeholder="请输入接口路径" />
|
><el-select v-model="aq.status" placeholder="状态" clearable style="width: 130px"
|
||||||
</el-form-item>
|
><el-option label="启用" value="active" /><el-option label="禁用" value="inactive" /></el-select></el-form-item
|
||||||
<el-form-item label="请求方式" prop="method">
|
><el-form-item label="方法" prop="method"
|
||||||
<el-select v-model="form.method" style="width: 100%">
|
><el-select v-model="aq.method" placeholder="请求方式" clearable style="width: 130px"
|
||||||
<el-option label="GET" value="GET" />
|
><el-option v-for="m in methods" :key="m" :label="m" :value="m" /></el-select></el-form-item
|
||||||
<el-option label="POST" value="POST" />
|
><el-form-item
|
||||||
<el-option label="PUT" value="PUT" />
|
><el-button type="primary" @click="searchApi"
|
||||||
<el-option label="DELETE" value="DELETE" />
|
><el-icon><ele-Search /></el-icon>查询</el-button
|
||||||
</el-select>
|
><el-button @click="resetApiQuery"
|
||||||
</el-form-item>
|
><el-icon><ele-Refresh /></el-icon>重置</el-button
|
||||||
<el-form-item label="所属平台" prop="datasourceId">
|
><el-button type="success" @click="openApi()"
|
||||||
<el-input v-model="form.datasourceId" placeholder="请输入所属平台ID" />
|
><el-icon><ele-FolderAdd /></el-icon>新增接口</el-button
|
||||||
</el-form-item>
|
></el-form-item
|
||||||
<el-form-item label="描述" prop="description">
|
></el-form
|
||||||
<el-input v-model="form.description" type="textarea" :rows="3" placeholder="请输入描述" />
|
><el-table :data="apiRows" v-loading="apiLoading"
|
||||||
</el-form-item>
|
><el-table-column type="index" label="序号" width="60" /><el-table-column
|
||||||
<el-form-item label="状态" prop="status">
|
prop="code"
|
||||||
<el-select v-model="form.status" style="width: 100%">
|
label="接口编码"
|
||||||
<el-option label="启用" :value="1" />
|
min-width="140"
|
||||||
<el-option label="禁用" :value="0" />
|
show-overflow-tooltip
|
||||||
</el-select>
|
/><el-table-column prop="name" label="接口名称" min-width="150" show-overflow-tooltip /><el-table-column
|
||||||
</el-form-item>
|
prop="url"
|
||||||
</el-form>
|
label="URL"
|
||||||
<template #footer>
|
min-width="220"
|
||||||
<el-button @click="dialog.visible = false">取消</el-button>
|
show-overflow-tooltip
|
||||||
<el-button type="primary" @click="onSubmit" :loading="dialog.saving">确定</el-button>
|
/><el-table-column prop="method" label="请求方式" width="100" align="center"
|
||||||
</template>
|
><template #default="s"
|
||||||
</el-dialog>
|
><el-tag size="small" :type="s.row.method === 'GET' ? 'success' : 'primary'">{{ s.row.method }}</el-tag></template
|
||||||
|
></el-table-column
|
||||||
|
><el-table-column prop="status" label="状态" width="90" align="center"
|
||||||
|
><template #default="s"
|
||||||
|
><el-tag size="small" :type="ns(s.row.status) === 'active' ? 'success' : 'danger'">{{
|
||||||
|
ns(s.row.status) === 'active' ? '启用' : '禁用'
|
||||||
|
}}</el-tag></template
|
||||||
|
></el-table-column
|
||||||
|
><el-table-column prop="platformName" label="所属平台" min-width="140" show-overflow-tooltip /> ><el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
width="170"
|
||||||
|
><template #default="s">{{ ft(s.row.createdAt) }}</template></el-table-column
|
||||||
|
><el-table-column label="操作" width="160" fixed="right"
|
||||||
|
><template #default="s"
|
||||||
|
><el-button size="small" text type="primary" @click="openApi(String(s.row.id))">修改</el-button
|
||||||
|
><el-button size="small" text type="danger" @click="delApi(s.row)">删除</el-button></template
|
||||||
|
></el-table-column
|
||||||
|
></el-table
|
||||||
|
><pagination :total="apiTotal" v-model:page="aq.pageNum" v-model:limit="aq.pageSize" @pagination="getApis" /></el-tab-pane></el-tabs
|
||||||
|
></el-card>
|
||||||
|
<el-dialog v-model="platformDialog.visible" :title="platformDialog.title" width="720px" :close-on-click-modal="false" destroy-on-close
|
||||||
|
><el-form ref="platformFormRef" :model="platformForm" :rules="platformRules" label-width="120px" v-loading="platformDialog.loading"
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="平台编码" prop="platformCode"><el-input v-model="platformForm.platformCode" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="平台名称" prop="platformName"><el-input v-model="platformForm.platformName" /></el-form-item></el-col></el-row
|
||||||
|
><el-form-item label="平台描述"><el-input v-model="platformForm.description" type="textarea" :rows="3" /></el-form-item
|
||||||
|
><el-form-item label="API地址"><el-input v-model="platformForm.apiBaseUrl" /></el-form-item
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="认证类型" prop="authType"
|
||||||
|
><el-select v-model="platformForm.authType" style="width: 100%"
|
||||||
|
><el-option label="Token" value="TOKEN" /><el-option label="API Key" value="API_KEY" /><el-option
|
||||||
|
label="OAuth2"
|
||||||
|
value="OAUTH2" /><el-option label="Basic" value="BASIC" /></el-select></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="状态" prop="status"
|
||||||
|
><el-select v-model="platformForm.status" style="width: 100%"
|
||||||
|
><el-option label="启用" value="ACTIVE" /><el-option label="停用" value="INACTIVE" /></el-select></el-form-item></el-col></el-row
|
||||||
|
><el-form-item label="Token/密钥"><el-input v-model="platformForm.token" show-password /></el-form-item
|
||||||
|
><el-form-item label="API Key"><el-input v-model="platformForm.apiKey" show-password /></el-form-item
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="Client ID"><el-input v-model="platformForm.clientId" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="Client Secret"><el-input v-model="platformForm.clientSecret" show-password /></el-form-item></el-col></el-row
|
||||||
|
><el-form-item label="认证配置 JSON" prop="authConfigText"
|
||||||
|
><el-input v-model="platformForm.authConfigText" type="textarea" :rows="6" /></el-form-item
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="限流/分钟"
|
||||||
|
><el-input-number v-model="platformForm.rateLimitPerMinute" :min="0" style="width: 100%" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="限流/小时"
|
||||||
|
><el-input-number v-model="platformForm.rateLimitPerHour" :min="0" style="width: 100%" /></el-form-item></el-col></el-row
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="并发限制"
|
||||||
|
><el-input-number v-model="platformForm.concurrencyLimit" :min="0" style="width: 100%" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="超时(ms)"
|
||||||
|
><el-input-number v-model="platformForm.requestTimeoutMs" :min="0" style="width: 100%" /></el-form-item></el-col></el-row
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="最大重试"><el-input-number v-model="platformForm.maxRetries" :min="0" style="width: 100%" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="重试延迟(ms)"
|
||||||
|
><el-input-number v-model="platformForm.retryDelayMs" :min="0" style="width: 100%" /></el-form-item></el-col></el-row></el-form
|
||||||
|
><template #footer
|
||||||
|
><el-button @click="platformDialog.visible = false">取消</el-button
|
||||||
|
><el-button type="primary" :loading="platformDialog.saving" @click="savePlatform">确定</el-button></template
|
||||||
|
></el-dialog
|
||||||
|
><el-dialog v-model="apiDialog.visible" :title="apiDialog.title" width="780px" :close-on-click-modal="false" destroy-on-close
|
||||||
|
><el-form ref="apiFormRef" :model="apiForm" :rules="apiRules" label-width="110px" v-loading="apiDialog.loading"
|
||||||
|
><el-form-item label="所属平台" prop="platformId"
|
||||||
|
><el-select v-model="apiForm.platformId" style="width: 100%" filterable
|
||||||
|
><el-option v-for="i in platforms" :key="i.id" :label="i.platformName" :value="String(i.id)" /></el-select></el-form-item
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="接口编码" prop="code"><el-input v-model="apiForm.code" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="接口名称" prop="name"><el-input v-model="apiForm.name" /></el-form-item></el-col></el-row
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="URL" prop="url"><el-input v-model="apiForm.url" /></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="请求方式" prop="method"
|
||||||
|
><el-select v-model="apiForm.method" style="width: 100%"
|
||||||
|
><el-option v-for="m in methods" :key="m" :label="m" :value="m" /></el-select></el-form-item></el-col></el-row
|
||||||
|
><el-row :gutter="16"
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="状态" prop="status"
|
||||||
|
><el-select v-model="apiForm.status" style="width: 100%"
|
||||||
|
><el-option label="启用" value="active" /><el-option label="禁用" value="inactive" /></el-select></el-form-item></el-col
|
||||||
|
><el-col :span="12"
|
||||||
|
><el-form-item label="认证类型"
|
||||||
|
><el-select v-model="apiForm.authType" style="width: 100%" clearable
|
||||||
|
><el-option label="Token" value="TOKEN" /><el-option label="API Key" value="API_KEY" /><el-option
|
||||||
|
label="OAuth2"
|
||||||
|
value="OAUTH2" /><el-option label="APP_SIGNATURE" value="APP_SIGNATURE" /></el-select></el-form-item></el-col></el-row
|
||||||
|
><el-form-item label="请求配置 JSON" prop="requestConfigText"
|
||||||
|
><el-input v-model="apiForm.requestConfigText" type="textarea" :rows="6" /></el-form-item
|
||||||
|
><el-form-item label="响应配置 JSON" prop="responseConfigText"
|
||||||
|
><el-input v-model="apiForm.responseConfigText" type="textarea" :rows="5" /></el-form-item
|
||||||
|
><el-form-item label="限流配置 JSON" prop="limitConfigText"
|
||||||
|
><el-input v-model="apiForm.limitConfigText" type="textarea" :rows="4" /></el-form-item
|
||||||
|
><el-form-item label="表结构定义 JSON" prop="tableDefinitionText"
|
||||||
|
><el-input v-model="apiForm.tableDefinitionText" type="textarea" :rows="6" /></el-form-item></el-form
|
||||||
|
><template #footer
|
||||||
|
><el-button @click="apiDialog.visible = false">取消</el-button
|
||||||
|
><el-button type="primary" :loading="apiDialog.saving" @click="saveApi">确定</el-button></template
|
||||||
|
></el-dialog
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default { name: 'cidApis' };
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
|
import type { FormInstance, FormRules } from 'element-plus';
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
const queryRef = ref<FormInstance>();
|
import { getApiErrorMessage } from '/@/utils/request';
|
||||||
const formRef = ref<FormInstance>();
|
import {
|
||||||
const ids = ref<string[]>([]);
|
createDatasourcePlatform,
|
||||||
|
deleteDatasourcePlatform,
|
||||||
const tableData = reactive({
|
getDatasourcePlatform,
|
||||||
data: [] as any[],
|
listDatasourcePlatforms,
|
||||||
total: 0,
|
updateDatasourcePlatform,
|
||||||
param: {
|
} from '/@/api/cid/datasource';
|
||||||
pageNum: 1,
|
import {
|
||||||
pageSize: 10,
|
createApiInterface,
|
||||||
keyword: '',
|
deleteApiInterface,
|
||||||
},
|
getApiInterface,
|
||||||
});
|
listApiInterfaces,
|
||||||
|
updateApiInterface,
|
||||||
const dialog = reactive({
|
type ApiInterfaceInfo,
|
||||||
visible: false,
|
} from '/@/api/cid/apis';
|
||||||
title: '',
|
defineOptions({ name: 'cidApis' });
|
||||||
saving: false,
|
const tab = ref('platform'),
|
||||||
});
|
methods = ['GET', 'POST', 'PUT', 'DELETE'],
|
||||||
|
platforms = ref<any[]>([]),
|
||||||
const form = reactive({
|
platformRows = ref<any[]>([]),
|
||||||
|
apiRows = ref<ApiInterfaceInfo[]>([]),
|
||||||
|
platformTotal = ref(0),
|
||||||
|
apiTotal = ref(0),
|
||||||
|
platformLoading = ref(false),
|
||||||
|
apiLoading = ref(false);
|
||||||
|
const pqf = ref<FormInstance>(),
|
||||||
|
aqf = ref<FormInstance>(),
|
||||||
|
platformFormRef = ref<FormInstance>(),
|
||||||
|
apiFormRef = ref<FormInstance>();
|
||||||
|
const pq = reactive({ pageNum: 1, pageSize: 10, keyword: '', status: '' }),
|
||||||
|
aq = reactive({ pageNum: 1, pageSize: 10, keyword: '', platformId: '', status: '', method: '' });
|
||||||
|
const platformDialog = reactive({ visible: false, title: '', loading: false, saving: false }),
|
||||||
|
apiDialog = reactive({ visible: false, title: '', loading: false, saving: false });
|
||||||
|
const dpf = () => ({
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
platformCode: '',
|
||||||
path: '',
|
platformName: '',
|
||||||
method: 'GET',
|
|
||||||
datasourceId: '',
|
|
||||||
description: '',
|
description: '',
|
||||||
status: 1,
|
apiBaseUrl: '',
|
||||||
|
authType: 'TOKEN',
|
||||||
|
status: 'ACTIVE',
|
||||||
|
token: '',
|
||||||
|
apiKey: '',
|
||||||
|
clientId: '',
|
||||||
|
clientSecret: '',
|
||||||
|
authConfigText: '{}',
|
||||||
|
rateLimitPerMinute: 60,
|
||||||
|
rateLimitPerHour: 1000,
|
||||||
|
concurrencyLimit: 10,
|
||||||
|
requestTimeoutMs: 30000,
|
||||||
|
maxRetries: 3,
|
||||||
|
retryDelayMs: 1000,
|
||||||
});
|
});
|
||||||
|
const daf = () => ({
|
||||||
const rules = {
|
id: '',
|
||||||
name: [{ required: true, message: '请输入接口名称', trigger: 'blur' }],
|
platformId: '',
|
||||||
path: [{ required: true, message: '请输入接口路径', trigger: 'blur' }],
|
code: '',
|
||||||
method: [{ required: true, message: '请选择请求方式', trigger: 'change' }],
|
name: '',
|
||||||
};
|
url: '',
|
||||||
|
method: 'GET',
|
||||||
const getList = () => {
|
status: 'active',
|
||||||
// TODO: 调用列表接口
|
authType: '',
|
||||||
};
|
requestConfigText: '{}',
|
||||||
|
responseConfigText: '{}',
|
||||||
const resetQuery = (formEl: FormInstance | undefined) => {
|
limitConfigText: '{}',
|
||||||
if (!formEl) return;
|
tableDefinitionText: '{}',
|
||||||
formEl.resetFields();
|
});
|
||||||
getList();
|
const platformForm = reactive(dpf()),
|
||||||
};
|
apiForm = reactive(daf());
|
||||||
|
const jv = (v: string, cb: (e?: Error) => void, l: string) => {
|
||||||
const handleSelectionChange = (selection: any[]) => {
|
if (!v) return cb();
|
||||||
ids.value = selection.map((item) => item.id);
|
try {
|
||||||
};
|
JSON.parse(v);
|
||||||
|
cb();
|
||||||
const onOpenAdd = () => {
|
} catch {
|
||||||
dialog.title = '新增接口';
|
cb(new Error(`${l} 格式错误`));
|
||||||
dialog.visible = true;
|
|
||||||
form.id = '';
|
|
||||||
form.name = '';
|
|
||||||
form.path = '';
|
|
||||||
form.method = 'GET';
|
|
||||||
form.datasourceId = '';
|
|
||||||
form.description = '';
|
|
||||||
form.status = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onOpenEdit = (row: any) => {
|
|
||||||
dialog.title = '修改接口';
|
|
||||||
dialog.visible = true;
|
|
||||||
form.id = row.id;
|
|
||||||
form.name = row.name;
|
|
||||||
form.path = row.path;
|
|
||||||
form.method = row.method;
|
|
||||||
form.datasourceId = row.datasourceId;
|
|
||||||
form.description = row.description;
|
|
||||||
form.status = row.status;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSubmit = () => {
|
|
||||||
if (!formRef.value) return;
|
|
||||||
formRef.value.validate((valid) => {
|
|
||||||
if (!valid) return;
|
|
||||||
dialog.saving = true;
|
|
||||||
// TODO: 调用新增/编辑接口
|
|
||||||
dialog.saving = false;
|
|
||||||
dialog.visible = false;
|
|
||||||
getList();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRowDel = (row: any) => {
|
|
||||||
const delIds = row ? [row.id] : ids.value;
|
|
||||||
if (delIds.length === 0) {
|
|
||||||
ElMessage.error('请选择要删除的数据');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
ElMessageBox.confirm(`确定要删除选中的接口吗?`, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
// TODO: 调用删除接口
|
|
||||||
ElMessage.success('删除成功');
|
|
||||||
getList();
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
};
|
||||||
|
const platformRules: FormRules = {
|
||||||
onMounted(() => {
|
platformCode: [{ required: true, message: '请输入平台编码', trigger: 'blur' }],
|
||||||
getList();
|
platformName: [{ required: true, message: '请输入平台名称', trigger: 'blur' }],
|
||||||
|
authType: [{ required: true, message: '请选择认证类型', trigger: 'change' }],
|
||||||
|
authConfigText: [{ validator: (_r, v, cb) => jv(v, cb, '认证配置 JSON'), trigger: 'blur' }],
|
||||||
|
};
|
||||||
|
const apiRules: FormRules = {
|
||||||
|
platformId: [{ required: true, message: '请选择所属平台', trigger: 'change' }],
|
||||||
|
code: [{ required: true, message: '请输入接口编码', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入接口名称', trigger: 'blur' }],
|
||||||
|
url: [{ required: true, message: '请输入接口 URL', trigger: 'blur' }],
|
||||||
|
method: [{ required: true, message: '请选择请求方式', trigger: 'change' }],
|
||||||
|
requestConfigText: [{ validator: (_r, v, cb) => jv(v, cb, '请求配置 JSON'), trigger: 'blur' }],
|
||||||
|
responseConfigText: [{ validator: (_r, v, cb) => jv(v, cb, '响应配置 JSON'), trigger: 'blur' }],
|
||||||
|
limitConfigText: [{ validator: (_r, v, cb) => jv(v, cb, '接口独立限流配置 JSON'), trigger: 'blur' }],
|
||||||
|
tableDefinitionText: [{ validator: (_r, v, cb) => jv(v, cb, '表结构定义 JSON'), trigger: 'blur' }],
|
||||||
|
};
|
||||||
|
const ft = (t?: number) => (!t ? '' : new Date(String(t).length === 10 ? t * 1000 : t).toLocaleString('zh-CN', { hour12: false })),
|
||||||
|
ns = (s?: string) => (String(s || '').toLowerCase() === 'active' ? 'active' : 'inactive');
|
||||||
|
const loadPlatforms = async () => {
|
||||||
|
const r = await listDatasourcePlatforms({ pageNum: 1, pageSize: 100 });
|
||||||
|
platforms.value = r.data?.list || [];
|
||||||
|
};
|
||||||
|
const getPlatforms = async () => {
|
||||||
|
platformLoading.value = true;
|
||||||
|
try {
|
||||||
|
const r = await listDatasourcePlatforms({
|
||||||
|
pageNum: pq.pageNum,
|
||||||
|
pageSize: pq.pageSize,
|
||||||
|
...(pq.keyword ? { keyword: pq.keyword } : {}),
|
||||||
|
...(pq.status ? { status: pq.status } : {}),
|
||||||
|
});
|
||||||
|
platformRows.value = r.data?.list || [];
|
||||||
|
platformTotal.value = r.data?.total || 0;
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '获取平台列表失败');
|
||||||
|
} finally {
|
||||||
|
platformLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getApis = async () => {
|
||||||
|
apiLoading.value = true;
|
||||||
|
try {
|
||||||
|
const r = await listApiInterfaces({
|
||||||
|
pageNum: aq.pageNum,
|
||||||
|
pageSize: aq.pageSize,
|
||||||
|
...(aq.keyword ? { keyword: aq.keyword } : {}),
|
||||||
|
...(aq.platformId ? { platformId: aq.platformId } : {}),
|
||||||
|
...(aq.status ? { status: aq.status } : {}),
|
||||||
|
...(aq.method ? { method: aq.method } : {}),
|
||||||
|
});
|
||||||
|
apiRows.value = r.data?.list || [];
|
||||||
|
apiTotal.value = r.data?.total || 0;
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '获取接口列表失败');
|
||||||
|
} finally {
|
||||||
|
apiLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onTab = () => (tab.value === 'platform' ? getPlatforms() : getApis());
|
||||||
|
const searchPlatform = () => {
|
||||||
|
pq.pageNum = 1;
|
||||||
|
getPlatforms();
|
||||||
|
};
|
||||||
|
const searchApi = () => {
|
||||||
|
aq.pageNum = 1;
|
||||||
|
getApis();
|
||||||
|
};
|
||||||
|
const resetPlatformQuery = () => {
|
||||||
|
pqf.value?.resetFields();
|
||||||
|
searchPlatform();
|
||||||
|
};
|
||||||
|
const resetApiQuery: any = () => {
|
||||||
|
aqf.value?.resetFields();
|
||||||
|
searchApi();
|
||||||
|
};
|
||||||
|
const openPlatform = async (row?: any) => {
|
||||||
|
Object.assign(platformForm, dpf());
|
||||||
|
platformFormRef.value?.clearValidate();
|
||||||
|
platformDialog.title = row ? '编辑平台' : '新建平台';
|
||||||
|
platformDialog.visible = true;
|
||||||
|
if (!row) return;
|
||||||
|
platformDialog.loading = true;
|
||||||
|
try {
|
||||||
|
const r = await getDatasourcePlatform(row.id);
|
||||||
|
const d = r.data || {};
|
||||||
|
Object.assign(platformForm, {
|
||||||
|
id: String(d.id || row.id),
|
||||||
|
platformCode: d.platformCode || '',
|
||||||
|
platformName: d.platformName || '',
|
||||||
|
description: d.description || '',
|
||||||
|
apiBaseUrl: d.apiBaseUrl || '',
|
||||||
|
authType: d.authType || 'TOKEN',
|
||||||
|
status: d.status || 'ACTIVE',
|
||||||
|
token: d.token || '',
|
||||||
|
apiKey: d.apiKey || '',
|
||||||
|
clientId: d.clientId || '',
|
||||||
|
clientSecret: d.clientSecret || '',
|
||||||
|
authConfigText: JSON.stringify(d.authConfig ?? {}, null, 2),
|
||||||
|
rateLimitPerMinute: d.rateLimitPerMinute ?? 60,
|
||||||
|
rateLimitPerHour: d.rateLimitPerHour ?? 1000,
|
||||||
|
concurrencyLimit: d.concurrencyLimit ?? 10,
|
||||||
|
requestTimeoutMs: d.requestTimeoutMs ?? 30000,
|
||||||
|
maxRetries: d.maxRetries ?? 3,
|
||||||
|
retryDelayMs: d.retryDelayMs ?? 1000,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
platformDialog.visible = false;
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '获取平台详情失败');
|
||||||
|
} finally {
|
||||||
|
platformDialog.loading = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const savePlatform = async () => {
|
||||||
|
if (!platformFormRef.value) return;
|
||||||
|
const ok = await platformFormRef.value.validate().catch(() => false);
|
||||||
|
if (!ok) return;
|
||||||
|
platformDialog.saving = true;
|
||||||
|
try {
|
||||||
|
const p = {
|
||||||
|
platformCode: platformForm.platformCode,
|
||||||
|
platformName: platformForm.platformName,
|
||||||
|
description: platformForm.description,
|
||||||
|
apiBaseUrl: platformForm.apiBaseUrl,
|
||||||
|
authType: platformForm.authType,
|
||||||
|
status: platformForm.status,
|
||||||
|
token: platformForm.token,
|
||||||
|
apiKey: platformForm.apiKey,
|
||||||
|
clientId: platformForm.clientId,
|
||||||
|
clientSecret: platformForm.clientSecret,
|
||||||
|
authConfig: JSON.parse(platformForm.authConfigText || '{}'),
|
||||||
|
rateLimitPerMinute: platformForm.rateLimitPerMinute || 60,
|
||||||
|
rateLimitPerHour: platformForm.rateLimitPerHour || 1000,
|
||||||
|
concurrencyLimit: platformForm.concurrencyLimit || 10,
|
||||||
|
requestTimeoutMs: platformForm.requestTimeoutMs || 30000,
|
||||||
|
maxRetries: platformForm.maxRetries || 3,
|
||||||
|
retryDelayMs: platformForm.retryDelayMs || 1000,
|
||||||
|
};
|
||||||
|
platformForm.id ? await updateDatasourcePlatform({ id: platformForm.id, ...p }) : await createDatasourcePlatform(p);
|
||||||
|
ElMessage.success(platformForm.id ? '更新成功' : '创建成功');
|
||||||
|
platformDialog.visible = false;
|
||||||
|
await Promise.all([getPlatforms(), loadPlatforms()]);
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || (platformForm.id ? '更新失败' : '创建失败'));
|
||||||
|
} finally {
|
||||||
|
platformDialog.saving = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const delPlatform = (row: any) => {
|
||||||
|
const ids = [row.id];
|
||||||
|
ElMessageBox.confirm(`确定删除平台「${row.platformName}」吗?`, '提示', { type: 'warning' })
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
for (const id of ids) await deleteDatasourcePlatform(id);
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
await Promise.all([getPlatforms(), loadPlatforms()]);
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '删除失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => undefined);
|
||||||
|
};
|
||||||
|
const openApi = async (id = '', platformId = '') => {
|
||||||
|
Object.assign(apiForm, daf(), platformId ? { platformId } : {});
|
||||||
|
apiFormRef.value?.clearValidate();
|
||||||
|
if (!platforms.value.length) await loadPlatforms();
|
||||||
|
apiDialog.title = id ? '编辑接口' : '新建接口';
|
||||||
|
apiDialog.visible = true;
|
||||||
|
if (!id) return;
|
||||||
|
apiDialog.loading = true;
|
||||||
|
try {
|
||||||
|
const r = await getApiInterface(id);
|
||||||
|
const d = r.data || {};
|
||||||
|
Object.assign(apiForm, {
|
||||||
|
id: String(d.id || id),
|
||||||
|
platformId: String(d.platformId || platformId || ''),
|
||||||
|
code: d.code || '',
|
||||||
|
name: d.name || '',
|
||||||
|
url: d.url || '',
|
||||||
|
method: d.method || 'GET',
|
||||||
|
status: ns(d.status),
|
||||||
|
authType: d.authType || '',
|
||||||
|
requestConfigText: JSON.stringify(d.requestConfig ?? {}, null, 2),
|
||||||
|
responseConfigText: JSON.stringify(d.responseConfig ?? {}, null, 2),
|
||||||
|
limitConfigText: JSON.stringify(d.limitConfig ?? {}, null, 2),
|
||||||
|
tableDefinitionText: JSON.stringify(d.tableDefinition ?? {}, null, 2),
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
apiDialog.visible = false;
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '获取接口详情失败');
|
||||||
|
} finally {
|
||||||
|
apiDialog.loading = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const saveApi = async () => {
|
||||||
|
if (!apiFormRef.value) return;
|
||||||
|
const ok = await apiFormRef.value.validate().catch(() => false);
|
||||||
|
if (!ok) return;
|
||||||
|
apiDialog.saving = true;
|
||||||
|
try {
|
||||||
|
const p = {
|
||||||
|
platformId: Number(apiForm.platformId),
|
||||||
|
code: apiForm.code,
|
||||||
|
name: apiForm.name,
|
||||||
|
url: apiForm.url,
|
||||||
|
method: apiForm.method,
|
||||||
|
status: apiForm.status,
|
||||||
|
authType: apiForm.authType || undefined,
|
||||||
|
requestConfig: JSON.parse(apiForm.requestConfigText || '{}'),
|
||||||
|
responseConfig: JSON.parse(apiForm.responseConfigText || '{}'),
|
||||||
|
limitConfig: JSON.parse(apiForm.limitConfigText || '{}'),
|
||||||
|
tableDefinition: JSON.parse(apiForm.tableDefinitionText || '{}'),
|
||||||
|
};
|
||||||
|
apiForm.id ? await updateApiInterface({ id: apiForm.id, ...p }) : await createApiInterface(p);
|
||||||
|
ElMessage.success(apiForm.id ? '更新成功' : '创建成功');
|
||||||
|
apiDialog.visible = false;
|
||||||
|
await getApis();
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || (apiForm.id ? '更新失败' : '创建失败'));
|
||||||
|
} finally {
|
||||||
|
apiDialog.saving = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const delApi = (row: any) => {
|
||||||
|
ElMessageBox.confirm(`确定删除接口「${row.name}」吗?`, '提示', { type: 'warning' })
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
await deleteApiInterface(String(row.id));
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
await getApis();
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error(getApiErrorMessage(e) || '删除失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => undefined);
|
||||||
|
};
|
||||||
|
onMounted(async () => {
|
||||||
|
await loadPlatforms();
|
||||||
|
await Promise.all([getPlatforms(), getApis()]);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
68
src/views/settings/creation/component/PromptSelector.vue
Normal file
68
src/views/settings/creation/component/PromptSelector.vue
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="visible" title="编辑提示词" width="720px" :close-on-click-modal="false" destroy-on-close @close="handleClose">
|
||||||
|
<div class="prompt-input-dialog">
|
||||||
|
<el-input v-model="promptContent" type="textarea" :rows="12" maxlength="5000" show-word-limit placeholder="请输入提示词内容" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="handleClose">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
modelValue: boolean;
|
||||||
|
defaultPrompt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:modelValue', value: boolean): void;
|
||||||
|
(e: 'confirm', promptContent: string): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: false,
|
||||||
|
defaultPrompt: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
const visible = ref(false);
|
||||||
|
const promptContent = ref('');
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(val) => {
|
||||||
|
visible.value = val;
|
||||||
|
if (val) {
|
||||||
|
promptContent.value = props.defaultPrompt || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(visible, (val) => {
|
||||||
|
if (!val) {
|
||||||
|
emit('update:modelValue', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleConfirm = () => {
|
||||||
|
emit('confirm', promptContent.value.trim());
|
||||||
|
handleClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.prompt-input-dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -240,18 +240,54 @@ const handleCreatePrivateModelAndSetChat = async () => {
|
|||||||
|
|
||||||
// 基于内置模型创建新模型(继承原模型的所有配置,只替换 apiKey)
|
// 基于内置模型创建新模型(继承原模型的所有配置,只替换 apiKey)
|
||||||
const builtInModel = builtInModelToClone.value;
|
const builtInModel = builtInModelToClone.value;
|
||||||
|
|
||||||
|
// Parse headMsg to Record<string, string> - it might be stored as string or already as object
|
||||||
|
let headMsgRecord: Record<string, string> = {};
|
||||||
|
if (builtInModel.headMsg && typeof builtInModel.headMsg === 'string') {
|
||||||
|
// Try to parse as JSON first (new format stored as string)
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(builtInModel.headMsg);
|
||||||
|
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
||||||
|
Object.entries(parsed).forEach(([k, v]) => {
|
||||||
|
headMsgRecord[k] = String(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// If JSON parse fails, parse as old format "key1:value1,key2:value2"
|
||||||
|
const pairs = builtInModel.headMsg.split(',');
|
||||||
|
pairs.forEach((pair: string) => {
|
||||||
|
const idx = pair.indexOf(':');
|
||||||
|
if (idx === -1) return;
|
||||||
|
const key = pair.slice(0, idx).trim();
|
||||||
|
const value = pair.slice(idx + 1).trim();
|
||||||
|
if (key) {
|
||||||
|
headMsgRecord[key] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (builtInModel.headMsg && typeof builtInModel.headMsg === 'object' && !Array.isArray(builtInModel.headMsg)) {
|
||||||
|
// Already an object
|
||||||
|
Object.entries(builtInModel.headMsg).forEach(([k, v]) => {
|
||||||
|
headMsgRecord[k] = String(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const createParams = {
|
const createParams = {
|
||||||
modelName: apiKeyForm.modelName,
|
modelName: apiKeyForm.modelName,
|
||||||
modelType: builtInModel.modelType,
|
modelType: builtInModel.modelType,
|
||||||
baseUrl: builtInModel.baseUrl,
|
baseUrl: builtInModel.baseUrl,
|
||||||
httpMethod: builtInModel.httpMethod || 'POST',
|
httpMethod: builtInModel.httpMethod || 'POST',
|
||||||
headMsg: builtInModel.headMsg || '',
|
headMsg: headMsgRecord,
|
||||||
isPrivate: builtInModel.isPrivate ?? 1,
|
isPrivate: builtInModel.isPrivate ?? 1,
|
||||||
enabled: builtInModel.enabled ?? 1,
|
enabled: builtInModel.enabled ?? 1,
|
||||||
isChatModel: 1, // 设置为会话模型
|
isChatModel: 1, // 设置为会话模型
|
||||||
|
callMode: builtInModel.callMode ?? builtInModel.isAsync ?? 0,
|
||||||
apiKey: apiKeyForm.apiKey,
|
apiKey: apiKeyForm.apiKey,
|
||||||
form: builtInModel.form || {},
|
form: builtInModel.form || {},
|
||||||
requestMapping: builtInModel.requestMapping || {},
|
requestMapping: builtInModel.requestMapping || {},
|
||||||
|
requiredFields: Array.isArray(builtInModel.requiredFields) ? builtInModel.requiredFields : [],
|
||||||
|
firstFrame: String(builtInModel.firstFrame || ''),
|
||||||
|
lastFrame: String(builtInModel.lastFrame || ''),
|
||||||
responseMapping: builtInModel.responseMapping || {},
|
responseMapping: builtInModel.responseMapping || {},
|
||||||
responseBody: builtInModel.responseBody || {},
|
responseBody: builtInModel.responseBody || {},
|
||||||
tokenMapping: builtInModel.tokenMapping || '',
|
tokenMapping: builtInModel.tokenMapping || '',
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="system-model-type-container layout-padding">
|
|
||||||
<el-card shadow="hover" class="layout-padding-auto">
|
|
||||||
<div class="system-model-type-search mb15">
|
|
||||||
<el-input v-model="state.tableData.param.keyword" size="default" placeholder="请输入模型类型名称" style="max-width: 180px" clearable> </el-input>
|
|
||||||
<el-button size="default" type="primary" class="ml10" @click="getTableData">
|
|
||||||
<el-icon>
|
|
||||||
<ele-Search />
|
|
||||||
</el-icon>
|
|
||||||
查询
|
|
||||||
</el-button>
|
|
||||||
<el-button size="default" type="success" class="ml10" @click="onOpenAddType('add')">
|
|
||||||
<el-icon>
|
|
||||||
<ele-FolderAdd />
|
|
||||||
</el-icon>
|
|
||||||
新增模型类型
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
|
|
||||||
<el-table-column type="index" label="序号" width="60" />
|
|
||||||
<el-table-column prop="typeName" label="类型名称" show-overflow-tooltip></el-table-column>
|
|
||||||
<el-table-column prop="typeCode" label="类型编码" show-overflow-tooltip></el-table-column>
|
|
||||||
<el-table-column prop="description" label="描述" show-overflow-tooltip></el-table-column>
|
|
||||||
<el-table-column prop="status" label="状态" width="100">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">{{ scope.row.status === 1 ? '启用' : '禁用' }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
|
|
||||||
<el-table-column label="操作" width="200">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button size="small" text type="primary" @click="onOpenEditType('edit', scope.row)">修改</el-button>
|
|
||||||
<el-button size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-pagination
|
|
||||||
@size-change="onHandleSizeChange"
|
|
||||||
@current-change="onHandleCurrentChange"
|
|
||||||
class="mt15"
|
|
||||||
:pager-count="5"
|
|
||||||
:page-sizes="[10, 20, 30]"
|
|
||||||
v-model:current-page="state.tableData.param.pageNum"
|
|
||||||
background
|
|
||||||
v-model:page-size="state.tableData.param.pageSize"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
:total="state.tableData.total"
|
|
||||||
>
|
|
||||||
</el-pagination>
|
|
||||||
</el-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts" name="digitalHumanModelType">
|
|
||||||
import { reactive, onMounted } from 'vue';
|
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
|
||||||
|
|
||||||
const state = reactive({
|
|
||||||
tableData: {
|
|
||||||
data: [],
|
|
||||||
total: 0,
|
|
||||||
loading: false,
|
|
||||||
param: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
keyword: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化表格数据
|
|
||||||
const getTableData = () => {
|
|
||||||
state.tableData.loading = true;
|
|
||||||
// TODO: 调用API获取数据
|
|
||||||
setTimeout(() => {
|
|
||||||
state.tableData.data = [];
|
|
||||||
state.tableData.total = 0;
|
|
||||||
state.tableData.loading = false;
|
|
||||||
}, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开新增模型类型弹窗
|
|
||||||
const onOpenAddType = (type: string) => {
|
|
||||||
ElMessage.info('功能开发中...');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 打开修改模型类型弹窗
|
|
||||||
const onOpenEditType = (type: string, row: any) => {
|
|
||||||
ElMessage.info('功能开发中...');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 删除模型类型
|
|
||||||
const onRowDel = (row: any) => {
|
|
||||||
ElMessage.info('功能开发中...');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 分页改变
|
|
||||||
const onHandleSizeChange = (val: number) => {
|
|
||||||
state.tableData.param.pageSize = val;
|
|
||||||
getTableData();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 分页改变
|
|
||||||
const onHandleCurrentChange = (val: number) => {
|
|
||||||
state.tableData.param.pageNum = val;
|
|
||||||
getTableData();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 页面加载时
|
|
||||||
onMounted(() => {
|
|
||||||
getTableData();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.system-model-type-container {
|
|
||||||
:deep(.el-card__body) {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex: 1;
|
|
||||||
overflow: auto;
|
|
||||||
.el-table {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
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 === 1" type="success">管理员</el-tag>
|
||||||
|
<el-tag v-else-if="row.sourceType === 2">用户</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: 2 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 = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
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
@@ -43,11 +43,6 @@
|
|||||||
<span class="ml10 text-muted">天(0表示永不过期)</span>
|
<span class="ml10 text-muted">天(0表示永不过期)</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="禁止重复使用次数" prop="historyLimit">
|
|
||||||
<el-input-number v-model="ruleForm.historyLimit" :min="0" :max="24" placeholder="请输入禁止重复使用次数" />
|
|
||||||
<span class="ml10 text-muted">次(0表示不限制)</span>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="登录失败锁定次数" prop="maxRetryCount">
|
<el-form-item label="登录失败锁定次数" prop="maxRetryCount">
|
||||||
<el-input-number v-model="ruleForm.maxRetryCount" :min="0" :max="10" placeholder="请输入登录失败锁定次数" />
|
<el-input-number v-model="ruleForm.maxRetryCount" :min="0" :max="10" placeholder="请输入登录失败锁定次数" />
|
||||||
<span class="ml10 text-muted">次(0表示不锁定)</span>
|
<span class="ml10 text-muted">次(0表示不锁定)</span>
|
||||||
@@ -85,7 +80,6 @@ interface RuleFormState {
|
|||||||
requireDigit: boolean;
|
requireDigit: boolean;
|
||||||
requireSpecialChar: boolean;
|
requireSpecialChar: boolean;
|
||||||
expireDays: number;
|
expireDays: number;
|
||||||
historyLimit: number;
|
|
||||||
maxRetryCount: number;
|
maxRetryCount: number;
|
||||||
lockTimeMinutes: number;
|
lockTimeMinutes: number;
|
||||||
remark: string;
|
remark: string;
|
||||||
@@ -112,7 +106,6 @@ export default defineComponent({
|
|||||||
requireDigit: true,
|
requireDigit: true,
|
||||||
requireSpecialChar: false,
|
requireSpecialChar: false,
|
||||||
expireDays: 90,
|
expireDays: 90,
|
||||||
historyLimit: 5,
|
|
||||||
maxRetryCount: 5,
|
maxRetryCount: 5,
|
||||||
lockTimeMinutes: 30,
|
lockTimeMinutes: 30,
|
||||||
remark: '',
|
remark: '',
|
||||||
@@ -127,9 +120,6 @@ export default defineComponent({
|
|||||||
expireDays: [
|
expireDays: [
|
||||||
{ required: true, message: '请输入密码过期天数', trigger: 'blur' }
|
{ required: true, message: '请输入密码过期天数', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
historyLimit: [
|
|
||||||
{ required: true, message: '请输入禁止重复使用次数', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
maxRetryCount: [
|
maxRetryCount: [
|
||||||
{ required: true, message: '请输入登录失败锁定次数', trigger: 'blur' }
|
{ required: true, message: '请输入登录失败锁定次数', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
|||||||
27
ssl/gitea.redpowerfuture.com.key
Normal file
27
ssl/gitea.redpowerfuture.com.key
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEowIBAAKCAQEAqlbH8ExzyW3D87glDgjSz6IoKWmV1iZh33DIYmDFzbaGqdBZ
|
||||||
|
gWyW4TWbBn9huVDrglShjeIEjAdfK3BcHKv4/xh+XjGjzp/GyvKkggLGB2Itc3Wq
|
||||||
|
wxlyAhlm7tgU0bmQGPu/+CnIvmss7lKWx9b5L9eYU+ToU3r/GOP4juGqcUYHLyhW
|
||||||
|
ZDjy2fjO5Ju4/W0U1OcaLho1Sapn9EFXFIjJ5RbiiOF8QVo8Ez3EbV/EsQowaIvp
|
||||||
|
OoqLT1GGBRd6sz/L1TMliw6UPcGd+TTaADTh4PxSklYsXqro0vstft0kiuAElah3
|
||||||
|
Hw3XZMNiRfAqJVvhc8/pXdA6kH4FuZKfxAF8CwIDAQABAoIBAEwB8DKKMsppZ9wr
|
||||||
|
SaGTD1pmHayo+Bq4Qsj83vWDABCUh09j8GR/i23PyS6jjXwvHv+nevVAKs4/Bdjw
|
||||||
|
yLFkjXVqvQyT8ueixQZPMlfvG+U0ilpwYXOwOX61Tgh6tAOHXUTApT77ih9p3IE1
|
||||||
|
qiFfDA8skUSyKncBta2qIAHFsZPcNGB+44hv5AT1aaXtZbuFdwAoptIpNDaWVmbo
|
||||||
|
cjm6AEHOoiTfXx437ORAx+F3e2umzBVkLQZNLPlYsz0pFN8elZAde1e13kAPUaHa
|
||||||
|
q5g49Yad4UA3iIO6xo3kZz90BGMlcbe0ckY8wOg9biF4zTxVg0unbvk4DZve8iTZ
|
||||||
|
hDrrAF0CgYEA3oakLouCgo/JWERfXVTYVyTvuh8wkYmsndV4s7hENIjhEiKrgfW1
|
||||||
|
4RfnVNEjgEbsukgyMj8GpeXp9d8mC5Jz9uhKbbpCbLIuTdZpeNvob4RA1a+rgP6L
|
||||||
|
Fan3W9yrMqmrz7gLW2PsPmU3vnn8SI/8QlgwmNLutbMPncWJzNukMM0CgYEAw/Zy
|
||||||
|
dqFjNIgHemnYpK1R0xcLVs6MTOOwqEv0xUor1fZujLittRbb4JAqDlUwQNU6Zn6K
|
||||||
|
xxuSJ3TrRHqpjLcT812yPeMXd1f7jzCnZXDkWYoUT/ILjIB9cEJuycTwDwMJGkPd
|
||||||
|
RGV+gyBPHYBM6+hhxh1YSYm0CebDPMRMC7anADcCgYBg/KYKc1vKtAi5o/M8poI0
|
||||||
|
WTDzGiz9AdhuYmBdVG7FxvLyCJJf7kv7c4OsAAtNGZyMBHN8WuP24qJ6O2xFlutc
|
||||||
|
LhpigM/6uB5eZplJx+8iy63GdO53JnpQUugw7ZjgV/s+aaTpjD+nYk5NgrVmmvsD
|
||||||
|
n5Rux2CraQPha/uHgiOp8QKBgQCwqh6ZOnfgZP4w6vmnxKUu4+iSEtXDf8XEg+2g
|
||||||
|
a3THiUoyzU+1IW2Krw1rLHu7B0CGJHDifcWukqaDbv4p4Oc4kPDfADsomYYtmhRf
|
||||||
|
zH3hBy22wSSOP0xXB10vw78UGY18Q1BYmBONDXSlyQQP7ckvvUbZzS4lewfqYaGZ
|
||||||
|
Mcqu0wKBgDh2tcdxuHUizlRAPwfoZ3JhbITJqGytkpZT96WpQ0fpzcSovNJf0shC
|
||||||
|
5gXCzWWRKQPxV7cUXmB6hBm1Q6WoZ/VKN36+R+7L8Pt7yTmZhBxQKVjVn3k849JC
|
||||||
|
tcWDXiZd5qINC7dsH/vjLahnr76cFtYfNM5stomJkKNRjC7hZfnw
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
62
ssl/gitea.redpowerfuture.com.pem
Normal file
62
ssl/gitea.redpowerfuture.com.pem
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIGJTCCBQ2gAwIBAgIQCXpUlFT9Cue3+TsPpxvnWjANBgkqhkiG9w0BAQsFADBu
|
||||||
|
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||||
|
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
|
||||||
|
RFYgVExTIENBIC0gRzIwHhcNMjYwNjEwMDAwMDAwWhcNMjYwOTA3MjM1OTU5WjAj
|
||||||
|
MSEwHwYDVQQDExhnaXRlYS5yZWRwb3dlcmZ1dHVyZS5jb20wggEiMA0GCSqGSIb3
|
||||||
|
DQEBAQUAA4IBDwAwggEKAoIBAQCqVsfwTHPJbcPzuCUOCNLPoigpaZXWJmHfcMhi
|
||||||
|
YMXNtoap0FmBbJbhNZsGf2G5UOuCVKGN4gSMB18rcFwcq/j/GH5eMaPOn8bK8qSC
|
||||||
|
AsYHYi1zdarDGXICGWbu2BTRuZAY+7/4Kci+ayzuUpbH1vkv15hT5OhTev8Y4/iO
|
||||||
|
4apxRgcvKFZkOPLZ+M7km7j9bRTU5xouGjVJqmf0QVcUiMnlFuKI4XxBWjwTPcRt
|
||||||
|
X8SxCjBoi+k6iotPUYYFF3qzP8vVMyWLDpQ9wZ35NNoANOHg/FKSVixequjS+y1+
|
||||||
|
3SSK4ASVqHcfDddkw2JF8ColW+Fzz+ld0DqQfgW5kp/EAXwLAgMBAAGjggMIMIID
|
||||||
|
BDAfBgNVHSMEGDAWgBR435GQX+7erPbFdevVTFVT7yRKtjAdBgNVHQ4EFgQUOiq0
|
||||||
|
OCRofHA6BrxoM9do+AWnNgowQQYDVR0RBDowOIIYZ2l0ZWEucmVkcG93ZXJmdXR1
|
||||||
|
cmUuY29tghx3d3cuZ2l0ZWEucmVkcG93ZXJmdXR1cmUuY29tMD4GA1UdIAQ3MDUw
|
||||||
|
MwYGZ4EMAQIBMCkwJwYIKwYBBQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQuY29t
|
||||||
|
L0NQUzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF
|
||||||
|
BwMCMIGABggrBgEFBQcBAQR0MHIwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRp
|
||||||
|
Z2ljZXJ0LmNvbTBKBggrBgEFBQcwAoY+aHR0cDovL2NhY2VydHMuZGlnaWNlcnQu
|
||||||
|
Y29tL0VuY3J5cHRpb25FdmVyeXdoZXJlRFZUTFNDQS1HMi5jcnQwDAYDVR0TAQH/
|
||||||
|
BAIwADCCAX0GCisGAQQB1nkCBAIEggFtBIIBaQFnAHUAwjF+V0UZo0XufzjespBB
|
||||||
|
68fCIVoiv3/Vta12mtkOUs0AAAGesEYy8QAABAMARjBEAiBD7255l5PRI6mZXWxU
|
||||||
|
iC7txvWxkLlBgVFzAkRrMW7RXQIgZyupslAslfGDqDMk9H948AFZGe0JwB6YiuXK
|
||||||
|
lx1sox0AdgDYCVU7lE96/8gWGW+UT4WrsPj8XodVJg8V0S5yu0VLFAAAAZ6wRjNI
|
||||||
|
AAAEAwBHMEUCIBqfIfl4sL0ME60NI0KG6JIHImcJjR5qkLGDjCp3sEhrAiEA4cvy
|
||||||
|
yFaz3BSjjQa+UspsqgfKxeTjCLJq5pLbDcgBgGQAdgCUTkOH+uzB74HzGSQmqBhl
|
||||||
|
AcfTXzgCAT9yZ31VNy4Z2AAAAZ6wRjL3AAAEAwBHMEUCIQDIIa8mLpO6BmhgCecw
|
||||||
|
pI+QNznn4lhIxmtJQyHmZo7qRAIgFPq9xlLLqqe5/+WgcNwoawggpi8skhg8t/yT
|
||||||
|
JJ5TmV0wDQYJKoZIhvcNAQELBQADggEBAOeiZrRwpNh/bNIuKe+1vWBrLHu2Zj70
|
||||||
|
cKAVUhT08ZAl8scEYusbuqtSAq+oz9sm595YyPgmrB0wSZEMTd/+pUy5GrrJAXal
|
||||||
|
kOx1a3TBxCvpK9F4T7KmBaBWA5HuljHfw9833jXi7v9jLYShDjyNRzSWeKl41kdt
|
||||||
|
Hq4CbDLXp9XVzVPBlOongGZV/6cDrvy4hoJcBq8UANU/QWw0PaJQWxPwHcULekBw
|
||||||
|
AefTX7JwKbHcZ3gGV4EzJU/eoycBOu9VsYgJu9U+p1nNjYHwS8RQjij+cgs8r5Wx
|
||||||
|
r4+wYkdN2767iK2+NRRdQD/ZqBMTgSZ6AXCM7gS8oP/ylLwnzyq7ikc=
|
||||||
|
-----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/minio.redpowerfuture.com.key
Normal file
27
ssl/minio.redpowerfuture.com.key
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAvoMUrxhR2vYC/tyGZlplkANptmFfqcglnd+ETk1ppE/tMyrI
|
||||||
|
PxBLvjN1BIcbBFkHthuv/Ut/dSgtS0hbI52Z1bMACbJ5SdPLTBZzNpXgHWXUHf/S
|
||||||
|
OsQB8s7gsCekcVly3Tf1emsXxcyeXQ7u8/ZrNEAKGZwT3xkAvtte01NqJeaIMddY
|
||||||
|
1o/nrlVhgV6CvDtCAFLRVvw2p5zc/Vejc/MLEXV4l9g3VIODfcIbLsczUmsT98zO
|
||||||
|
LOwwgVssCQcdnA12T1X3U4sX4U0Pin0MexT5L8/Kx3pHbajpQK+ID0TDpmP4QKf5
|
||||||
|
QkAHJxM7py4u1EHNBo3nkrxWNPfZTTnhbvowjwIDAQABAoIBAAcLQ14FU615ZXtK
|
||||||
|
kxZAvGWamAjcHn82vRv9EjVvoPrS0Q3lxI6ptGs9bX5eh84ILq6kj8QZS7FSFs6k
|
||||||
|
R75lit+/D77MCwutmY7gJkq74ulOBQ2bkl3a4R7lraLFwcubx5FMtYuyXv17cdWL
|
||||||
|
V6Qh6y0nkFgJuyWyFSLOwKRRVBOU8KTldFLR+iF7oULALpUZeci9RF+EEGKarFmp
|
||||||
|
07OjPbLjdBl+FT05c2KRy4lVl+BRQB6YfU+Al84VQPdoE8byE3mrzomo6CiMTCQ9
|
||||||
|
aNN2QfpVZ6x16gOEcgpJZHYvD+gC5H7q//TWBJ/jdR6ToKYcRK7HOJQjZgUFLSUs
|
||||||
|
wCf1ybkCgYEA7V7XkB10SdfT2axO2jdsRM3kW1U86k//dF26G4OKlRmWpibcJXnk
|
||||||
|
i0M3be0b1VrqefYEWot3MVhJheQCCa+tNR4hSovN7FqCNVUzXZ8YWrTaycXi46po
|
||||||
|
urfRLUeupTXJinBfmIPCdbqr0bPOJ0q5NfpG+LeG0LlsAfxjALgjGrcCgYEAzXbG
|
||||||
|
0TLaDNwB3aXTUPpsL7DrrQTaVi9ScH5sa2IJjes2Pv/MyTB05JyHG9rqAtIShjJi
|
||||||
|
/N3qMnN0q40GSnzPj99+Sep3p+41LvxfvRma9HMZRnczyPZIT31TMQF++QP3d8gz
|
||||||
|
giDVNND0GXY11bwcqIuS+ouNwU4P6tvLKznQIOkCgYEAxBZ0JuZeGV5E8O2p2hSs
|
||||||
|
yQ35FgYNI1dgpUWEJ5R71/3ieHFjrUXLqcumL5YPRyoqxwOXxyCtH0NawVOA53WL
|
||||||
|
tXSldcqWGykNpXczzqRN3yjGEKb7bq1ohM6y6x/rQylyy31XS0uVSeIibEKIC+dr
|
||||||
|
pw6QsIgTw7tZYS6YrpBu13MCgYBb5t7zP+2shtQG0l98/yZZBqfEEkGe/ze+va29
|
||||||
|
MnLXmff/oed1rkj64NDGMtstO82xXORN+u0AeAgdm8zOkJk+31bbtRakdLYxOA2S
|
||||||
|
xds7sCgEDtmI8DBT7djCOMsUkyOj3la7w/fZ0gT9RpS575RaB2RM0RMs/b+862cr
|
||||||
|
BIcF0QKBgQCrO6f1zj9vr4h3nWohSjgpAkZHpeUxDf6s39U960JU5Dvz/bhCHr51
|
||||||
|
uuVO183cFmx9W8IW6BI4dwEKk5MrXD2hdM8uGAIi+ip/SwBqej072HuY1xD2Elp9
|
||||||
|
mWXLESLAedhWvp9QhNQbHib1RzaPV8TUgCDN/QLGQE+jdVqfk/Smfw==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
62
ssl/minio.redpowerfuture.com.pem
Normal file
62
ssl/minio.redpowerfuture.com.pem
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIGJTCCBQ2gAwIBAgIQAWng8l3t5rBYcCmLpCDdJTANBgkqhkiG9w0BAQsFADBu
|
||||||
|
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||||
|
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
|
||||||
|
RFYgVExTIENBIC0gRzIwHhcNMjYwNjEyMDAwMDAwWhcNMjYwOTA5MjM1OTU5WjAj
|
||||||
|
MSEwHwYDVQQDExhtaW5pby5yZWRwb3dlcmZ1dHVyZS5jb20wggEiMA0GCSqGSIb3
|
||||||
|
DQEBAQUAA4IBDwAwggEKAoIBAQC+gxSvGFHa9gL+3IZmWmWQA2m2YV+pyCWd34RO
|
||||||
|
TWmkT+0zKsg/EEu+M3UEhxsEWQe2G6/9S391KC1LSFsjnZnVswAJsnlJ08tMFnM2
|
||||||
|
leAdZdQd/9I6xAHyzuCwJ6RxWXLdN/V6axfFzJ5dDu7z9ms0QAoZnBPfGQC+217T
|
||||||
|
U2ol5ogx11jWj+euVWGBXoK8O0IAUtFW/DannNz9V6Nz8wsRdXiX2DdUg4N9whsu
|
||||||
|
xzNSaxP3zM4s7DCBWywJBx2cDXZPVfdTixfhTQ+KfQx7FPkvz8rHekdtqOlAr4gP
|
||||||
|
RMOmY/hAp/lCQAcnEzunLi7UQc0GjeeSvFY099lNOeFu+jCPAgMBAAGjggMIMIID
|
||||||
|
BDAfBgNVHSMEGDAWgBR435GQX+7erPbFdevVTFVT7yRKtjAdBgNVHQ4EFgQUm+W1
|
||||||
|
VEi2C0CdxtuncyBFtX9cS5UwQQYDVR0RBDowOIIYbWluaW8ucmVkcG93ZXJmdXR1
|
||||||
|
cmUuY29tghx3d3cubWluaW8ucmVkcG93ZXJmdXR1cmUuY29tMD4GA1UdIAQ3MDUw
|
||||||
|
MwYGZ4EMAQIBMCkwJwYIKwYBBQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQuY29t
|
||||||
|
L0NQUzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF
|
||||||
|
BwMCMIGABggrBgEFBQcBAQR0MHIwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRp
|
||||||
|
Z2ljZXJ0LmNvbTBKBggrBgEFBQcwAoY+aHR0cDovL2NhY2VydHMuZGlnaWNlcnQu
|
||||||
|
Y29tL0VuY3J5cHRpb25FdmVyeXdoZXJlRFZUTFNDQS1HMi5jcnQwDAYDVR0TAQH/
|
||||||
|
BAIwADCCAX0GCisGAQQB1nkCBAIEggFtBIIBaQFnAHUAwjF+V0UZo0XufzjespBB
|
||||||
|
68fCIVoiv3/Vta12mtkOUs0AAAGeucefAgAABAMARjBEAiBdD793ndAhFw/xk4gS
|
||||||
|
Pycc/U4IGSbSFNg1wXMMBkma9gIgSK8LNW9lqHn4wEYFRQrBfmYMUkJhUR51JmOb
|
||||||
|
rUESBu8AdgDXbX0Q0af1d8LH6V/XAL/5gskzWmXh0LMBcxfAyMVpdwAAAZ65x57r
|
||||||
|
AAAEAwBHMEUCIALrNS+sHrfHVl72YGHkqSb4quYzH6xZ0JNCTLakfjK4AiEA0jbR
|
||||||
|
ORUL7BLzYbw5geZfMb8NJmD+7CbgXdHNPWmowdYAdgCUTkOH+uzB74HzGSQmqBhl
|
||||||
|
AcfTXzgCAT9yZ31VNy4Z2AAAAZ65x58NAAAEAwBHMEUCIQCn753LSIK5ODnAw8za
|
||||||
|
2BUf7PZQhtwhe1I0fEfrFjwcAAIgPZtnV83cNV8UK9zGQhWso4QX/oK+ziXQMuP5
|
||||||
|
+lApPpcwDQYJKoZIhvcNAQELBQADggEBAKceFp1JWPgaR5TGrMXQNY0qgRPhY0ZC
|
||||||
|
MSVLqtbgWPeODl3p+BTpLJ/taGR1v1mlL/2cM+EU/RQVDobYUu91Td0Tibp1T8vv
|
||||||
|
KKgnGTj8fVTzimTR5YsFHKc0XFqHpbneArZFb9tbMnRLheDjAqJ3Xs5H5t/XNDSi
|
||||||
|
vasqxdvAYZPP+7JZPRrFqq/fPZR79NRz7kl45YiQX199d/8oPRVFRrq1TGtp41Nk
|
||||||
|
7rP31tq0YZDpBHXXmpYXmOZalWBHoASnZJDq0+H5bSBzNVHR25eOZe0dt5lWMzrf
|
||||||
|
bzFMatWnPKI/aLhc3GGZAxyy7PCRA5pJGB+qnaJAakODvB02VvJey/Y=
|
||||||
|
-----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-----
|
||||||
Reference in New Issue
Block a user