feat: add Status and RagChat pages with corresponding components and styles
- Created StatusPage component with system stats, configuration, and indexed documents overview. - Added RagChatPage component for chat functionality. - Introduced global CSS styles for light and dark themes, including utility classes and animations. - Defined TypeScript types for compliance, documents, and themes. - Configured Tailwind CSS for dynamic theming and custom animations. - Set up TypeScript configuration for app and node environments. - Initialized Vite configuration for React project.
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
73
README.md
Normal file
73
README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# React + TypeScript + Vite
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
||||
|
||||
## React Compiler
|
||||
|
||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||
|
||||
## Expanding the ESLint configuration
|
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
|
||||
```js
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
tseslint.configs.stylisticTypeChecked,
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from 'eslint-plugin-react-x'
|
||||
import reactDom from 'eslint-plugin-react-dom'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs['recommended-typescript'],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
22
eslint.config.js
Normal file
22
eslint.config.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
},
|
||||
},
|
||||
])
|
||||
13
index.html
Normal file
13
index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>regulation-rag</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
3150
package-lock.json
generated
Normal file
3150
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
34
package.json
Normal file
34
package.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "regulation-rag",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.2.5",
|
||||
"react-dom": "^19.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tailwindcss/postcss": "^4.2.4",
|
||||
"@types/node": "^24.12.2",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"autoprefixer": "^10.5.0",
|
||||
"eslint": "^10.2.1",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^17.5.0",
|
||||
"postcss": "^8.5.14",
|
||||
"tailwindcss": "^4.2.4",
|
||||
"typescript": "~6.0.2",
|
||||
"typescript-eslint": "^8.58.2",
|
||||
"vite": "^8.0.10"
|
||||
}
|
||||
}
|
||||
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
1
public/favicon.svg
Normal file
1
public/favicon.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 9.3 KiB |
24
public/icons.svg
Normal file
24
public/icons.svg
Normal file
@@ -0,0 +1,24 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="bluesky-icon" viewBox="0 0 16 17">
|
||||
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
|
||||
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
|
||||
</symbol>
|
||||
<symbol id="discord-icon" viewBox="0 0 20 19">
|
||||
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
|
||||
</symbol>
|
||||
<symbol id="documentation-icon" viewBox="0 0 21 20">
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
|
||||
</symbol>
|
||||
<symbol id="github-icon" viewBox="0 0 19 19">
|
||||
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
|
||||
</symbol>
|
||||
<symbol id="social-icon" viewBox="0 0 20 20">
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
|
||||
</symbol>
|
||||
<symbol id="x-icon" viewBox="0 0 19 19">
|
||||
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
BIN
public/logo/t_mobile_logo_transparent.png
Normal file
BIN
public/logo/t_mobile_logo_transparent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
184
src/App.css
Normal file
184
src/App.css
Normal file
@@ -0,0 +1,184 @@
|
||||
.counter {
|
||||
font-size: 16px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;
|
||||
color: var(--accent);
|
||||
background: var(--accent-bg);
|
||||
border: 2px solid transparent;
|
||||
transition: border-color 0.3s;
|
||||
margin-bottom: 24px;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
|
||||
.base,
|
||||
.framework,
|
||||
.vite {
|
||||
inset-inline: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.base {
|
||||
width: 170px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.framework,
|
||||
.vite {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.framework {
|
||||
z-index: 1;
|
||||
top: 34px;
|
||||
height: 28px;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
|
||||
scale(1.4);
|
||||
}
|
||||
|
||||
.vite {
|
||||
z-index: 0;
|
||||
top: 107px;
|
||||
height: 26px;
|
||||
width: auto;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
|
||||
scale(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
#center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 25px;
|
||||
place-content: center;
|
||||
place-items: center;
|
||||
flex-grow: 1;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
padding: 32px 20px 24px;
|
||||
gap: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps {
|
||||
display: flex;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: left;
|
||||
|
||||
& > div {
|
||||
flex: 1 1 0;
|
||||
padding: 32px;
|
||||
@media (max-width: 1024px) {
|
||||
padding: 24px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-bottom: 16px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
#docs {
|
||||
border-right: 1px solid var(--border);
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin: 32px 0 0;
|
||||
|
||||
.logo {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text-h);
|
||||
font-size: 16px;
|
||||
border-radius: 6px;
|
||||
background: var(--social-bg);
|
||||
display: flex;
|
||||
padding: 6px 12px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
text-decoration: none;
|
||||
transition: box-shadow 0.3s;
|
||||
|
||||
&:hover {
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.button-icon {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
li {
|
||||
flex: 1 1 calc(50% - 8px);
|
||||
}
|
||||
|
||||
a {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 88px;
|
||||
border-top: 1px solid var(--border);
|
||||
@media (max-width: 1024px) {
|
||||
height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
.ticks {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -4.5px;
|
||||
border: 5px solid transparent;
|
||||
}
|
||||
|
||||
&::before {
|
||||
left: 0;
|
||||
border-left-color: var(--border);
|
||||
}
|
||||
&::after {
|
||||
right: 0;
|
||||
border-right-color: var(--border);
|
||||
}
|
||||
}
|
||||
48
src/App.tsx
Normal file
48
src/App.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import './styles/globals.css';
|
||||
import { ThemeProvider, AppProvider, useApp, useTheme } from './contexts';
|
||||
import { Header, Tabs } from './components/layout';
|
||||
import { CompliancePage } from './pages/Compliance';
|
||||
import { DocsPage } from './pages/Docs';
|
||||
import { StatusPage } from './pages/Status';
|
||||
import { RagChatPage } from './pages/RagChat';
|
||||
|
||||
const PageContent = () => {
|
||||
const { activeTab } = useApp();
|
||||
|
||||
switch (activeTab) {
|
||||
case 'docs':
|
||||
return <DocsPage />;
|
||||
case 'compliance':
|
||||
return <CompliancePage />;
|
||||
case 'status':
|
||||
return <StatusPage />;
|
||||
case 'rag':
|
||||
return <RagChatPage />;
|
||||
default:
|
||||
return <CompliancePage />;
|
||||
}
|
||||
};
|
||||
|
||||
const AppContent = () => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col min-h-screen" style={{ backgroundColor: theme.bg }}>
|
||||
<Header />
|
||||
<Tabs />
|
||||
<PageContent />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<ThemeProvider>
|
||||
<AppProvider>
|
||||
<AppContent />
|
||||
</AppProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
BIN
src/assets/hero.png
Normal file
BIN
src/assets/hero.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
1
src/assets/react.svg
Normal file
1
src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
1
src/assets/vite.svg
Normal file
1
src/assets/vite.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.5 KiB |
15
src/components/common/TLogo.tsx
Normal file
15
src/components/common/TLogo.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
|
||||
interface TLogoProps {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export const TLogo: React.FC<TLogoProps> = ({ size = 40 }) => (
|
||||
<img
|
||||
src="/logo/t_mobile_logo_transparent.png"
|
||||
alt="T-Systems"
|
||||
width={size}
|
||||
height={size}
|
||||
style={{ objectFit: 'contain' }}
|
||||
/>
|
||||
);
|
||||
30
src/components/common/TPattern.tsx
Normal file
30
src/components/common/TPattern.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
export const TPattern: React.FC = () => {
|
||||
const { theme, isDark } = useTheme();
|
||||
const patternOpacity = isDark ? 0.03 : 0.04;
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
width: 300,
|
||||
height: 300,
|
||||
opacity: patternOpacity,
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
>
|
||||
<svg width="300" height="300" viewBox="0 0 300 300">
|
||||
<defs>
|
||||
<pattern id="grid" width="30" height="30" patternUnits="userSpaceOnUse">
|
||||
<path d="M 30 0 L 0 0 0 30" fill="none" stroke={theme.accent} strokeWidth="1"/>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect width="300" height="300" fill="url(#grid)"/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
35
src/components/common/ThemeToggle.tsx
Normal file
35
src/components/common/ThemeToggle.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
export const ThemeToggle: React.FC = () => {
|
||||
const { isDark, toggleTheme, theme } = useTheme();
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={toggleTheme}
|
||||
style={{
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 10,
|
||||
background: isDark ? theme.bgHover : theme.bgCard,
|
||||
border: `1px solid ${theme.border}`,
|
||||
cursor: 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
transition: 'all 0.3s ease',
|
||||
}}
|
||||
>
|
||||
{isDark ? (
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="4" fill={theme.accent}/>
|
||||
<path d="M12 2V4M12 20V22M4 12H2M22 12H20M6.34 6.34L4.93 4.93M19.07 19.07L17.66 17.66M6.34 17.66L4.93 19.07M19.07 4.93L17.66 6.34" stroke={theme.accent} strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" fill={theme.accent} stroke={theme.accent} strokeWidth="1"/>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
3
src/components/common/index.ts
Normal file
3
src/components/common/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { TLogo } from './TLogo';
|
||||
export { ThemeToggle } from './ThemeToggle';
|
||||
export { TPattern } from './TPattern';
|
||||
27
src/components/layout/Content.tsx
Normal file
27
src/components/layout/Content.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface ContentProps {
|
||||
children: React.ReactNode;
|
||||
wide?: boolean;
|
||||
}
|
||||
|
||||
export const Content: React.FC<ContentProps> = ({ children, wide = false }) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
return (
|
||||
<main
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: '48px 56px',
|
||||
maxWidth: wide ? 1400 : 1100,
|
||||
margin: '0 auto',
|
||||
width: '100%',
|
||||
position: 'relative',
|
||||
backgroundColor: theme.bg,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</main>
|
||||
);
|
||||
};
|
||||
47
src/components/layout/Header.tsx
Normal file
47
src/components/layout/Header.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import { TLogo } from '../common/TLogo';
|
||||
import { ThemeToggle } from '../common/ThemeToggle';
|
||||
|
||||
export const Header: React.FC = () => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
return (
|
||||
<header
|
||||
className="h-[72px] flex items-center justify-between sticky top-0 z-[100]"
|
||||
style={{
|
||||
padding: '0 48px',
|
||||
borderBottom: `1px solid ${theme.border}`,
|
||||
backgroundColor: theme.bg,
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center" style={{ gap: 20 }}>
|
||||
<TLogo size={80} />
|
||||
<div className="flex items-baseline" style={{ gap: 12 }}>
|
||||
<span style={{ fontWeight: 700, fontSize: 20, letterSpacing: '-0.5px', color: theme.text }}>
|
||||
T-Systems
|
||||
</span>
|
||||
<span style={{ fontWeight: 300, fontSize: 16, color: theme.text2 }}>
|
||||
Regulation RAG
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center" style={{ gap: 16 }}>
|
||||
<ThemeToggle />
|
||||
<div
|
||||
className="flex items-center rounded-lg"
|
||||
style={{
|
||||
padding: '8px 16px',
|
||||
gap: 8,
|
||||
backgroundColor: theme.bgHover,
|
||||
borderRadius: 8,
|
||||
}}
|
||||
>
|
||||
<span className="mono" style={{ fontSize: 11, color: theme.text3 }}>v1.0.0</span>
|
||||
<div style={{ width: 1, height: 12, background: theme.border }} />
|
||||
<span className="mono" style={{ fontSize: 12, color: theme.green }}>● ONLINE</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
47
src/components/layout/Tabs.tsx
Normal file
47
src/components/layout/Tabs.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import { useTheme, useApp } from '../../contexts';
|
||||
|
||||
const tabs = [
|
||||
{ id: 'docs', label: '文档管理' },
|
||||
{ id: 'compliance', label: '合规分析' },
|
||||
{ id: 'status', label: '系统状态' },
|
||||
{ id: 'rag', label: 'RAG对话' },
|
||||
];
|
||||
|
||||
export const Tabs: React.FC = () => {
|
||||
const { theme } = useTheme();
|
||||
const { activeTab, setActiveTab } = useApp();
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="h-[56px] flex items-center"
|
||||
style={{
|
||||
padding: '0 48px',
|
||||
borderBottom: `1px solid ${theme.border}`,
|
||||
backgroundColor: theme.bg,
|
||||
}}
|
||||
>
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveTab(tab.id as any)}
|
||||
style={{
|
||||
height: 56,
|
||||
padding: '0 32px',
|
||||
fontSize: 15,
|
||||
fontWeight: activeTab === tab.id ? 600 : 400,
|
||||
color: activeTab === tab.id ? theme.accent : theme.text3,
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
borderBottom: activeTab === tab.id ? `3px solid ${theme.accent}` : '3px solid transparent',
|
||||
marginBottom: -1,
|
||||
cursor: 'pointer',
|
||||
transition: 'all 0.2s ease',
|
||||
}}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
3
src/components/layout/index.ts
Normal file
3
src/components/layout/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { Header } from './Header';
|
||||
export { Tabs } from './Tabs';
|
||||
export { Content } from './Content';
|
||||
40
src/components/ui/Badge.tsx
Normal file
40
src/components/ui/Badge.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface BadgeProps {
|
||||
children: React.ReactNode;
|
||||
color?: 'accent' | 'green' | 'orange' | 'red';
|
||||
size?: 'sm' | 'md';
|
||||
}
|
||||
|
||||
export const Badge: React.FC<BadgeProps> = ({
|
||||
children,
|
||||
color = 'accent',
|
||||
size = 'sm',
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
const colorStyles = {
|
||||
accent: { bg: theme.gradientAccent, text: '#fff' },
|
||||
green: { bg: theme.green, text: '#fff' },
|
||||
orange: { bg: theme.orange, text: '#fff' },
|
||||
red: { bg: '#ff4444', text: '#fff' },
|
||||
};
|
||||
|
||||
const sizeStyles = {
|
||||
sm: 'px-2 py-0.5 text-xs',
|
||||
md: 'px-3 py-1 text-sm',
|
||||
};
|
||||
|
||||
return (
|
||||
<span
|
||||
className={`${sizeStyles[size]} rounded font-mono font-medium`}
|
||||
style={{
|
||||
background: colorStyles[color].bg,
|
||||
color: colorStyles[color].text,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
60
src/components/ui/Button.tsx
Normal file
60
src/components/ui/Button.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface ButtonProps {
|
||||
variant?: 'primary' | 'secondary';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
children: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const Button: React.FC<ButtonProps> = ({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
children,
|
||||
onClick,
|
||||
disabled = false,
|
||||
className = '',
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
const baseStyles = `
|
||||
inline-flex items-center justify-center
|
||||
font-semibold rounded-xl cursor-pointer
|
||||
transition-all duration-300 ease
|
||||
disabled:cursor-not-allowed disabled:opacity-50
|
||||
`;
|
||||
|
||||
const sizeStyles = {
|
||||
sm: 'px-3 py-1.5 text-xs',
|
||||
md: 'px-5 py-3 text-sm',
|
||||
lg: 'px-8 py-5 text-base',
|
||||
};
|
||||
|
||||
const variantStyles = {
|
||||
primary: `
|
||||
bg-gradient-to-r from-t-accent to-t-accent-dark
|
||||
text-white hover:shadow-t-accent hover:-translate-y-0.5
|
||||
hover:from-[#f0208a] hover:to-[#d01070]
|
||||
`,
|
||||
secondary: `
|
||||
bg-t-bg-hover border border-t-border
|
||||
text-t-text2 hover:bg-t-bg-elevated
|
||||
`,
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
className={`${baseStyles} ${sizeStyles[size]} ${variantStyles[variant]} ${className}`}
|
||||
style={{
|
||||
color: variant === 'primary' ? '#fff' : theme.text2,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
54
src/components/ui/Card.tsx
Normal file
54
src/components/ui/Card.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface CardProps {
|
||||
accent?: boolean;
|
||||
highlight?: boolean;
|
||||
padding?: 'sm' | 'md' | 'lg';
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export const Card: React.FC<CardProps> = ({
|
||||
accent = false,
|
||||
highlight = false,
|
||||
padding = 'md',
|
||||
children,
|
||||
className = '',
|
||||
onClick,
|
||||
}) => {
|
||||
const { theme, isDark } = useTheme();
|
||||
|
||||
const paddingStyles = {
|
||||
sm: 'p-4',
|
||||
md: 'p-5',
|
||||
lg: 'p-8',
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={onClick}
|
||||
className={`
|
||||
rounded-xl border transition-all duration-200 cursor-default
|
||||
${paddingStyles[padding]}
|
||||
${accent ? 'border-t-accent' : 'border-t-border'}
|
||||
${highlight ? 'border-2 border-t-accent' : ''}
|
||||
${!isDark ? 'shadow-t-card' : ''}
|
||||
${onClick ? 'cursor-pointer hover:border-t-accent' : ''}
|
||||
${className}
|
||||
`}
|
||||
style={{
|
||||
backgroundColor: theme.bgCard,
|
||||
}}
|
||||
>
|
||||
{accent && (
|
||||
<div
|
||||
className="absolute top-0 left-0 right-0 h-[3px] rounded-t-xl"
|
||||
style={{ background: theme.gradientAccent }}
|
||||
/>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
45
src/components/ui/Input.tsx
Normal file
45
src/components/ui/Input.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface InputProps {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
placeholder?: string;
|
||||
onKeyDown?: (e: React.KeyboardEvent) => void;
|
||||
className?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export const Input: React.FC<InputProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
placeholder = '',
|
||||
onKeyDown,
|
||||
className = '',
|
||||
type = 'text',
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
placeholder={placeholder}
|
||||
className={`
|
||||
w-full px-4 py-3 text-sm
|
||||
bg-t-bg-card border border-t-border rounded-lg
|
||||
text-t-text outline-none
|
||||
focus:border-t-accent focus:ring-1 focus:ring-t-accent
|
||||
placeholder:text-t-text3
|
||||
${className}
|
||||
`}
|
||||
style={{
|
||||
backgroundColor: theme.bgCard,
|
||||
borderColor: theme.border,
|
||||
color: theme.text,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
43
src/components/ui/ProgressBar.tsx
Normal file
43
src/components/ui/ProgressBar.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface ProgressBarProps {
|
||||
percent: number;
|
||||
color?: 'accent' | 'green' | 'orange' | 'red';
|
||||
showLabel?: boolean;
|
||||
}
|
||||
|
||||
export const ProgressBar: React.FC<ProgressBarProps> = ({
|
||||
percent,
|
||||
color = 'accent',
|
||||
showLabel = false,
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
const colorStyles = {
|
||||
accent: theme.gradientAccent,
|
||||
green: `linear-gradient(90deg, ${theme.green}, #00ff88)`,
|
||||
orange: `linear-gradient(90deg, ${theme.orange}, #ffaa00)`,
|
||||
red: '#ff4444',
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
<div
|
||||
className="h-2 rounded-full flex-1"
|
||||
style={{ backgroundColor: theme.bgHover }}
|
||||
>
|
||||
<div
|
||||
className="h-full rounded-full transition-all duration-300"
|
||||
style={{
|
||||
width: `${percent}%`,
|
||||
background: colorStyles[color],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{showLabel && (
|
||||
<span className="font-mono text-xs text-t-accent">{percent}%</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
52
src/components/ui/ScoreBar.tsx
Normal file
52
src/components/ui/ScoreBar.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
||||
interface ScoreBarProps {
|
||||
score: number; // 0-100
|
||||
label?: string;
|
||||
accent?: boolean;
|
||||
}
|
||||
|
||||
export const ScoreBar: React.FC<ScoreBarProps> = ({
|
||||
score,
|
||||
label,
|
||||
accent = false,
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
|
||||
return (
|
||||
<div
|
||||
className="p-5 rounded-xl border"
|
||||
style={{
|
||||
backgroundColor: theme.bgCard,
|
||||
borderColor: accent ? theme.accent : theme.border,
|
||||
}}
|
||||
>
|
||||
{label && (
|
||||
<div
|
||||
className="font-mono text-xs mb-2"
|
||||
style={{ color: theme.text3, letterSpacing: '1px' }}
|
||||
>
|
||||
{label}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className="font-mono text-3xl font-bold"
|
||||
style={{ color: accent ? theme.accent : theme.text }}
|
||||
>
|
||||
{score}
|
||||
</div>
|
||||
<div className="flex gap-1 mt-2">
|
||||
{[...Array(10)].map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="w-2 h-4 rounded-sm"
|
||||
style={{
|
||||
backgroundColor: i < score / 10 ? theme.accent : theme.bgHover,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
6
src/components/ui/index.ts
Normal file
6
src/components/ui/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export { Button } from './Button';
|
||||
export { Card } from './Card';
|
||||
export { Input } from './Input';
|
||||
export { Badge } from './Badge';
|
||||
export { ProgressBar } from './ProgressBar';
|
||||
export { ScoreBar } from './ScoreBar';
|
||||
32
src/contexts/AppContext.tsx
Normal file
32
src/contexts/AppContext.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createContext, useContext, useState, type ReactNode } from 'react';
|
||||
|
||||
type TabId = 'docs' | 'compliance' | 'status' | 'rag';
|
||||
|
||||
interface AppContextValue {
|
||||
activeTab: TabId;
|
||||
setActiveTab: (tab: TabId) => void;
|
||||
}
|
||||
|
||||
const AppContext = createContext<AppContextValue | undefined>(undefined);
|
||||
|
||||
export const useApp = (): AppContextValue => {
|
||||
const context = useContext(AppContext);
|
||||
if (!context) {
|
||||
throw new Error('useApp must be used within an AppProvider');
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
interface AppProviderProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const AppProvider: React.FC<AppProviderProps> = ({ children }) => {
|
||||
const [activeTab, setActiveTab] = useState<TabId>('compliance');
|
||||
|
||||
return (
|
||||
<AppContext.Provider value={{ activeTab, setActiveTab }}>
|
||||
{children}
|
||||
</AppContext.Provider>
|
||||
);
|
||||
};
|
||||
49
src/contexts/ThemeContext.tsx
Normal file
49
src/contexts/ThemeContext.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import React, { createContext, useContext, useState, useEffect, type ReactNode } from 'react';
|
||||
import { darkTheme, lightTheme } from '../types/theme';
|
||||
import type { ThemeColors } from '../types/theme';
|
||||
|
||||
interface ThemeContextValue {
|
||||
isDark: boolean;
|
||||
theme: ThemeColors;
|
||||
toggleTheme: () => void;
|
||||
}
|
||||
|
||||
const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
||||
|
||||
export const useTheme = (): ThemeContextValue => {
|
||||
const context = useContext(ThemeContext);
|
||||
if (!context) {
|
||||
throw new Error('useTheme must be used within a ThemeProvider');
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
interface ThemeProviderProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
|
||||
const [isDark, setIsDark] = useState<boolean>(true);
|
||||
const theme = isDark ? darkTheme : lightTheme;
|
||||
|
||||
const toggleTheme = () => {
|
||||
setIsDark((prev) => !prev);
|
||||
};
|
||||
|
||||
// Apply class to document for Tailwind dark mode + body background
|
||||
useEffect(() => {
|
||||
if (isDark) {
|
||||
document.documentElement.classList.add('dark');
|
||||
document.body.style.background = '#0a0a12';
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.body.style.background = '#ffffff';
|
||||
}
|
||||
}, [isDark]);
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ isDark, theme, toggleTheme }}>
|
||||
{children}
|
||||
</ThemeContext.Provider>
|
||||
);
|
||||
};
|
||||
2
src/contexts/index.ts
Normal file
2
src/contexts/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { ThemeProvider, useTheme } from './ThemeContext';
|
||||
export { AppProvider, useApp } from './AppContext';
|
||||
7
src/data/index.ts
Normal file
7
src/data/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from './mockDocs';
|
||||
export * from './mockResults';
|
||||
export * from './mockDocumentContent';
|
||||
export * from './mockComplianceChunks';
|
||||
export * from './mockPriorityActions';
|
||||
export * from './mockRetrievalData';
|
||||
export * from './mockAIResponses';
|
||||
21
src/data/mockAIResponses.ts
Normal file
21
src/data/mockAIResponses.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export const mockAIResponses: Record<string, {
|
||||
compliance: string;
|
||||
interpretation: string;
|
||||
suggestion: string;
|
||||
}> = {
|
||||
'车身结构设计': {
|
||||
compliance: '根据GB 26112-2010第4.2条,车顶结构需承受1.5倍整备质量的载荷。您的设计提到"满足GB 26112-2010抗压强度要求",但缺少具体的承载数值说明。\n\n建议补充:实际测试承载值为XX倍整备质量,以满足法规要求。',
|
||||
interpretation: '热成型钢板(厚度2.5mm)用于A柱和B柱是合理的设计选择。C-NCAP管理规则第3.1条要求正面碰撞后车门应能打开,建议在设计中明确说明碰撞后车门开启性能。',
|
||||
suggestion: '建议补充以下细节以完善合规性:\n1. 车顶抗压强度具体数值\n2. A柱/B柱材料认证标准\n3. 碰撞测试验证数据',
|
||||
},
|
||||
'动力系统配置': {
|
||||
compliance: '充电接口符合GB/T 18487.1-2015标准,电池能量密度180Wh/kg远超GB/T 31484-2015要求的120Wh/kg最低标准,合规性良好。\n\n注意:需提供电池热失控测试报告以满足GB 38031-2020要求。',
|
||||
interpretation: '快充30分钟充至80%符合行业标准,但需确保充电系统具备以下安全功能:\n- 过充保护\n- 温度监控\n- 通信协议符合GB/T 27930',
|
||||
suggestion: '建议补充:\n1. 电池热失控测试报告\n2. 充电系统通信协议版本\n3. 快充循环寿命测试数据',
|
||||
},
|
||||
'安全配置设计': {
|
||||
compliance: '6个安全气囊配置符合GB 27887-2011对乘用车的基本要求。AEB和FCW功能是C-NCAP评分加分项。\n\n方向盘疲劳监测摄像头符合高级辅助驾驶趋势,但法规暂无强制要求。',
|
||||
interpretation: '博世第9代ESP具备碰撞预警和AEB功能,符合当前主流安全标准。建议明确AEB的触发条件和响应时间参数。',
|
||||
suggestion: '建议完善:\n1. AEB触发条件说明\n2. 安全气囊预紧器响应时间\n3. ESP系统认证文件',
|
||||
},
|
||||
};
|
||||
46
src/data/mockComplianceChunks.ts
Normal file
46
src/data/mockComplianceChunks.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { ComplianceChunk } from '../types';
|
||||
|
||||
export const mockComplianceChunks: ComplianceChunk[] = [
|
||||
{
|
||||
id: 1,
|
||||
index: 1,
|
||||
intent: '车身结构设计',
|
||||
startPos: 45,
|
||||
endPos: 230,
|
||||
content: '车身采用高强度钢铝混合结构,A柱和B柱使用热成型钢板,厚度2.5mm。车顶结构设计满足GB 26112-2010抗压强度要求,正面碰撞能量吸收区域采用渐进式变形设计,确保碰撞时能量有效分散。',
|
||||
regulations: [
|
||||
{ id: 1, name: 'GB 26112-2010', clause: '第4.2条', score: 0.95, matchKeyword: '车顶抗压强度', category: 'high', fullContent: '车顶结构应能承受相当于车辆整备质量1.5倍的载荷...' },
|
||||
{ id: 2, name: 'C-NCAP管理规则', clause: '第3.1条', score: 0.88, matchKeyword: '正面碰撞', category: 'high', fullContent: '正面碰撞试验速度为50km/h,碰撞后车门应能打开...' },
|
||||
{ id: 3, name: 'GB 11551-2014', clause: '第5条', score: 0.72, matchKeyword: '碰撞能量吸收', category: 'medium', fullContent: '车辆正面碰撞时应有效保护乘员...' },
|
||||
{ id: 4, name: '机动车安全技术条件', clause: '第12条', score: 0.58, matchKeyword: 'A柱强度', category: 'medium', fullContent: 'A柱应具备足够的抗变形能力...' },
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
index: 2,
|
||||
intent: '动力系统配置',
|
||||
startPos: 298,
|
||||
endPos: 425,
|
||||
content: '搭载永磁同步电机,最大功率150kW,峰值扭矩310Nm。电池组采用三元锂离子电池,容量75kWh,能量密度180Wh/kg。充电接口支持快充(30分钟充至80%)和慢充(8小时充满),符合GB/T 18487.1-2015标准。',
|
||||
regulations: [
|
||||
{ id: 5, name: 'GB/T 18487.1-2015', clause: '第6条', score: 0.94, matchKeyword: '充电接口标准', category: 'high', fullContent: '电动汽车传导充电接口应符合标准要求...' },
|
||||
{ id: 6, name: 'GB/T 31484-2015', clause: '第4条', score: 0.85, matchKeyword: '电池能量密度', category: 'high', fullContent: '动力电池能量密度不低于120Wh/kg...' },
|
||||
{ id: 7, name: '新能源汽车生产企业准入', clause: '第8条', score: 0.65, matchKeyword: '电机功率', category: 'medium', fullContent: '驱动电机应符合相关技术标准...' },
|
||||
{ id: 8, name: '电动汽车安全要求', clause: '第7条', score: 0.45, matchKeyword: '充电时间', category: 'low', fullContent: '充电系统应具备过充保护功能...' },
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
index: 3,
|
||||
intent: '安全配置设计',
|
||||
startPos: 570,
|
||||
endPos: 725,
|
||||
content: '配备6个安全气囊(前排双气囊、侧气囊、侧气帘),采用预紧式安全带。ABS系统采用博世第9代ESP,具备碰撞预警功能(FCW)和自动紧急制动(AEB)。方向盘集成驾驶员疲劳监测摄像头。',
|
||||
regulations: [
|
||||
{ id: 9, name: 'GB 27887-2011', clause: '第5条', score: 0.92, matchKeyword: '安全气囊', category: 'high', fullContent: '乘用车应配备驾驶员和乘客安全气囊...' },
|
||||
{ id: 10, name: 'GB/T 26991-2011', clause: '第3条', score: 0.78, matchKeyword: 'ABS系统', category: 'medium', fullContent: '车辆应配备防抱死制动系统...' },
|
||||
{ id: 11, name: 'C-NCAP管理规则', clause: '第4.2条', score: 0.71, matchKeyword: 'AEB自动制动', category: 'medium', fullContent: '主动安全配置评分包含AEB功能...' },
|
||||
{ id: 12, name: '机动车运行安全技术条件', clause: '第15条', score: 0.38, matchKeyword: '疲劳监测', category: 'low', fullContent: '建议配备驾驶员状态监测系统...' },
|
||||
]
|
||||
},
|
||||
];
|
||||
7
src/data/mockDocs.ts
Normal file
7
src/data/mockDocs.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Doc } from '../types';
|
||||
|
||||
export const mockDocs: Doc[] = [
|
||||
{ id: 1, name: '道路交通安全法.pdf', chunks: 124, size: '1.2MB', status: 'indexed' },
|
||||
{ id: 2, name: '机动车登记规定.docx', chunks: 58, size: '856KB', status: 'indexed' },
|
||||
{ id: 3, name: '电动自行车规范.pdf', chunks: 32, size: '245KB', status: 'indexed' },
|
||||
];
|
||||
31
src/data/mockDocumentContent.ts
Normal file
31
src/data/mockDocumentContent.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
export const fullDocumentContent = `
|
||||
车辆设计方案 v2.0
|
||||
|
||||
一、车身结构设计
|
||||
|
||||
车身采用高强度钢铝混合结构,A柱和B柱使用热成型钢板,厚度2.5mm。车顶结构设计满足GB 26112-2010抗压强度要求,正面碰撞能量吸收区域采用渐进式变形设计,确保碰撞时能量有效分散。
|
||||
|
||||
车身侧面采用铝合金板材,减轻整车重量约15%。底盘结构采用模块化设计,便于后续维修和零部件更换。车门内部设置防撞梁,提升侧面碰撞安全性。
|
||||
|
||||
二、动力系统配置
|
||||
|
||||
搭载永磁同步电机,最大功率150kW,峰值扭矩310Nm。电池组采用三元锂离子电池,容量75kWh,能量密度180Wh/kg。充电接口支持快充(30分钟充至80%)和慢充(8小时充满),符合GB/T 18487.1-2015标准。
|
||||
|
||||
电机控制器采用水冷散热系统,工作温度范围-30℃至60℃。电池包内置BMS管理系统,实时监控电池状态,具备过充、过放、过温等多重保护功能。
|
||||
|
||||
三、安全配置设计
|
||||
|
||||
配备6个安全气囊(前排双气囊、侧气囊、侧气帘),采用预紧式安全带。ABS系统采用博世第9代ESP,具备碰撞预警功能(FCW)和自动紧急制动(AEB)。方向盘集成驾驶员疲劳监测摄像头。
|
||||
|
||||
安全带预紧器在碰撞发生前0.1秒自动收紧,配合气囊提供最佳保护效果。AEB系统在城市工况下可有效避免85%以上的碰撞事故。疲劳监测系统通过面部特征识别,实时提醒驾驶员注意休息。
|
||||
|
||||
四、车身外观设计
|
||||
|
||||
车身尺寸:长4650mm,宽1850mm,高1450mm,轴距2800mm。前大灯采用LED矩阵式设计,具备自适应远近光切换功能。尾灯采用贯穿式设计,提升视觉辨识度。
|
||||
|
||||
五、内饰设计方案
|
||||
|
||||
驾驶舱采用环抱式设计,中控台配备12.3英寸触摸屏。仪表盘采用全液晶显示,支持多种主题切换。座椅采用真皮包裹,具备8向电动调节和加热通风功能。
|
||||
|
||||
方向盘采用三辐式设计,集成多功能控制按键。车内氛围灯采用可调色设计,支持256色自定义。音响系统配备12扬声器,支持环绕声效果。
|
||||
`;
|
||||
28
src/data/mockPriorityActions.ts
Normal file
28
src/data/mockPriorityActions.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { PriorityAction } from '../types';
|
||||
|
||||
export const mockPriorityActions: PriorityAction[] = [
|
||||
{
|
||||
id: 1,
|
||||
regulation: 'GB 26112-2010 第4.2条',
|
||||
issue: '车顶抗压强度',
|
||||
suggestion: '建议补充具体承载测试数据,明确车顶结构承受载荷倍数达到1.5倍以上',
|
||||
chunkId: 1,
|
||||
severity: 'high',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
regulation: 'GB/T 31484-2015 第4条',
|
||||
issue: '电池能量密度',
|
||||
suggestion: '当前180Wh/kg已达标,建议补充热失控测试报告以满足GB 38031-2020',
|
||||
chunkId: 2,
|
||||
severity: 'medium',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
regulation: 'C-NCAP管理规则 第3.1条',
|
||||
issue: '正面碰撞验证',
|
||||
suggestion: '建议提供碰撞后车门开启性能测试数据',
|
||||
chunkId: 1,
|
||||
severity: 'medium',
|
||||
},
|
||||
];
|
||||
7
src/data/mockResults.ts
Normal file
7
src/data/mockResults.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { SearchResult } from '../types';
|
||||
|
||||
export const mockResults: SearchResult[] = [
|
||||
{ id: 1, score: 0.92, law: '《道路交通安全法》第十八条', preview: '电动自行车应当符合国家标准,应当登记后方可上路行驶...', source: '道路交通安全法.pdf' },
|
||||
{ id: 2, score: 0.87, law: '《电动自行车安全技术规范》第二条', preview: '最高设计车速不超过25km/h,整车质量≤55kg...', source: '电动自行车规范.pdf' },
|
||||
{ id: 3, score: 0.79, law: '《道路交通安全法实施条例》第七十二条', preview: '驾驶电动自行车应当遵守下列规定...', source: '道路交通安全法.pdf' },
|
||||
];
|
||||
8
src/data/mockRetrievalData.ts
Normal file
8
src/data/mockRetrievalData.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { RetrievalData } from '../types';
|
||||
|
||||
export const mockRetrievalData: RetrievalData[] = [
|
||||
{ id: 1, file: '道路交通安全法.pdf', clause: '第十八条', score: 0.92, content: '电动自行车应当符合国家标准,应当登记后方可上路行驶。电动自行车的设计最高车速、整车质量、外形尺寸等应当符合国家标准。' },
|
||||
{ id: 2, file: '电动自行车规范.pdf', clause: '第二条', score: 0.87, content: '最高设计车速不超过25km/h,整车质量(含电池)不超过55kg,具有脚踏骑行能力,蓄电池标称电压不超过48V。' },
|
||||
{ id: 3, file: '道路交通安全法.pdf', clause: '第七十二条', score: 0.79, content: '驾驶电动自行车在道路上行驶,应当遵守下列规定:佩戴安全头盔;不得逆向行驶;不得在机动车道内行驶。' },
|
||||
{ id: 4, file: '机动车登记规定.pdf', clause: '第五条', score: 0.72, content: '初次申领机动车号牌、行驶证的,应当向住所地的车辆管理所申请注册登记,填写申请表,交验机动车。' },
|
||||
];
|
||||
111
src/index.css
Normal file
111
src/index.css
Normal file
@@ -0,0 +1,111 @@
|
||||
:root {
|
||||
--text: #6b6375;
|
||||
--text-h: #08060d;
|
||||
--bg: #fff;
|
||||
--border: #e5e4e7;
|
||||
--code-bg: #f4f3ec;
|
||||
--accent: #aa3bff;
|
||||
--accent-bg: rgba(170, 59, 255, 0.1);
|
||||
--accent-border: rgba(170, 59, 255, 0.5);
|
||||
--social-bg: rgba(244, 243, 236, 0.5);
|
||||
--shadow:
|
||||
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
|
||||
|
||||
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
|
||||
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
|
||||
--mono: ui-monospace, Consolas, monospace;
|
||||
|
||||
font: 18px/145% var(--sans);
|
||||
letter-spacing: 0.18px;
|
||||
color-scheme: light dark;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--text: #9ca3af;
|
||||
--text-h: #f3f4f6;
|
||||
--bg: #16171d;
|
||||
--border: #2e303a;
|
||||
--code-bg: #1f2028;
|
||||
--accent: #c084fc;
|
||||
--accent-bg: rgba(192, 132, 252, 0.15);
|
||||
--accent-border: rgba(192, 132, 252, 0.5);
|
||||
--social-bg: rgba(47, 48, 58, 0.5);
|
||||
--shadow:
|
||||
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
|
||||
}
|
||||
|
||||
#social .button-icon {
|
||||
filter: invert(1) brightness(2);
|
||||
}
|
||||
}
|
||||
|
||||
#root {
|
||||
width: 1126px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
border-inline: 1px solid var(--border);
|
||||
min-height: 100svh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-family: var(--heading);
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 56px;
|
||||
letter-spacing: -1.68px;
|
||||
margin: 32px 0;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 36px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
}
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 118%;
|
||||
letter-spacing: -0.24px;
|
||||
margin: 0 0 8px;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
code,
|
||||
.counter {
|
||||
font-family: var(--mono);
|
||||
display: inline-flex;
|
||||
border-radius: 4px;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 15px;
|
||||
line-height: 135%;
|
||||
padding: 4px 8px;
|
||||
background: var(--code-bg);
|
||||
}
|
||||
9
src/main.tsx
Normal file
9
src/main.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import App from './App.tsx';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
);
|
||||
246
src/pages/Compliance/ChatPanel.tsx
Normal file
246
src/pages/Compliance/ChatPanel.tsx
Normal file
@@ -0,0 +1,246 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import type { ComplianceChunk } from '../../types';
|
||||
|
||||
interface ChatPanelProps {
|
||||
activeChunkId: number;
|
||||
chunks: ComplianceChunk[];
|
||||
messages: Array<{ id: number; role: 'user' | 'assistant'; content: string }>;
|
||||
chatInput: string;
|
||||
setChatInput: (value: string) => void;
|
||||
chatLoading: boolean;
|
||||
sendChatMessage: () => void;
|
||||
closeChat: () => void;
|
||||
quickQuestions?: string[];
|
||||
}
|
||||
|
||||
export const ChatPanel: React.FC<ChatPanelProps> = ({
|
||||
activeChunkId,
|
||||
chunks,
|
||||
messages,
|
||||
chatInput,
|
||||
setChatInput,
|
||||
chatLoading,
|
||||
sendChatMessage,
|
||||
closeChat,
|
||||
quickQuestions = [
|
||||
'这个设计是否合规?',
|
||||
'需要修改哪些内容?',
|
||||
'法规的具体要求是什么?',
|
||||
],
|
||||
}) => {
|
||||
const { theme } = useTheme();
|
||||
const activeChunk = chunks.find(c => c.id === activeChunkId);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
width: 420,
|
||||
background: theme.bgCard,
|
||||
borderLeft: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
zIndex: 50,
|
||||
animation: 'slideIn 0.3s ease-out forwards',
|
||||
}}
|
||||
>
|
||||
{/* Chat Header */}
|
||||
<div style={{
|
||||
padding: '20px 24px',
|
||||
borderBottom: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
}}>
|
||||
<div>
|
||||
<div style={{ fontSize: 14, fontWeight: 600, color: theme.text }}>合规对话</div>
|
||||
<div className="mono" style={{ fontSize: 11, color: theme.text3 }}>
|
||||
段落 #{activeChunk?.index} · {activeChunk?.regulations.length} 条法规
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={closeChat}
|
||||
style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.bgHover,
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M18 6L6 18M6 6L18 18" stroke={theme.text3} strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Current Chunk Info */}
|
||||
<div style={{
|
||||
padding: '16px 24px',
|
||||
background: theme.bgHover,
|
||||
borderBottom: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
<div style={{ fontSize: 13, fontWeight: 500, marginBottom: 8, color: theme.text }}>
|
||||
{activeChunk?.intent}
|
||||
</div>
|
||||
<div style={{
|
||||
fontSize: 12,
|
||||
color: theme.text2,
|
||||
lineHeight: 1.5,
|
||||
maxHeight: 60,
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
{activeChunk?.content.substring(0, 100)}...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Chat Messages */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
overflowY: 'auto',
|
||||
padding: '20px 24px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 16,
|
||||
}}>
|
||||
{messages.map(msg => (
|
||||
<div key={msg.id} style={{
|
||||
display: 'flex',
|
||||
gap: 12,
|
||||
flexDirection: msg.role === 'user' ? 'row-reverse' : 'row',
|
||||
}}>
|
||||
{msg.role === 'assistant' && (
|
||||
<div style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
<div style={{
|
||||
maxWidth: '80%',
|
||||
padding: '12px 16px',
|
||||
background: msg.role === 'user' ? theme.gradientAccent : theme.bgElevated,
|
||||
borderRadius: 12,
|
||||
color: msg.role === 'user' ? '#fff' : theme.text,
|
||||
fontSize: 14,
|
||||
lineHeight: 1.6,
|
||||
whiteSpace: 'pre-wrap',
|
||||
border: msg.role === 'assistant' ? `1px solid ${theme.border}` : 'none',
|
||||
}}>
|
||||
{msg.content}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{chatLoading && (
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<div style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div style={{
|
||||
padding: '12px 16px',
|
||||
background: theme.bgElevated,
|
||||
borderRadius: 12,
|
||||
border: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
}}>
|
||||
<div style={{ width: 6, height: 6, borderRadius: '50%', background: theme.accent, animation: 'pulse 1s infinite' }} />
|
||||
<span style={{ fontSize: 13, color: theme.text2 }}>分析中...</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Quick Questions */}
|
||||
<div style={{
|
||||
padding: '12px 24px',
|
||||
display: 'flex',
|
||||
gap: 8,
|
||||
flexWrap: 'wrap',
|
||||
}}>
|
||||
{quickQuestions.map(q => (
|
||||
<button
|
||||
key={q}
|
||||
onClick={() => { setChatInput(q); }}
|
||||
style={{
|
||||
padding: '6px 12px',
|
||||
fontSize: 12,
|
||||
background: theme.bgHover,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 6,
|
||||
color: theme.text2,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>{q}</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Chat Input */}
|
||||
<div style={{
|
||||
padding: '16px 24px',
|
||||
borderTop: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
gap: 12,
|
||||
}}>
|
||||
<input
|
||||
value={chatInput}
|
||||
onChange={e => setChatInput(e.target.value)}
|
||||
onKeyDown={e => e.key === 'Enter' && sendChatMessage()}
|
||||
placeholder="输入问题..."
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: 12,
|
||||
fontSize: 14,
|
||||
background: theme.bgHover,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 8,
|
||||
color: theme.text,
|
||||
outline: 'none',
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
onClick={sendChatMessage}
|
||||
disabled={chatLoading || !chatInput.trim()}
|
||||
style={{
|
||||
padding: '12px 20px',
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
background: chatLoading || !chatInput.trim() ? theme.bgHover : theme.gradientAccent,
|
||||
color: chatLoading || !chatInput.trim() ? theme.text3 : '#fff',
|
||||
border: 'none',
|
||||
borderRadius: 8,
|
||||
cursor: chatLoading || !chatInput.trim() ? 'not-allowed' : 'pointer',
|
||||
}}
|
||||
>发送</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
1816
src/pages/Compliance/CompliancePage.tsx
Normal file
1816
src/pages/Compliance/CompliancePage.tsx
Normal file
File diff suppressed because it is too large
Load Diff
2
src/pages/Compliance/index.ts
Normal file
2
src/pages/Compliance/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { CompliancePage } from './CompliancePage';
|
||||
export { ChatPanel } from './ChatPanel';
|
||||
174
src/pages/Docs/DocsPage.tsx
Normal file
174
src/pages/Docs/DocsPage.tsx
Normal file
@@ -0,0 +1,174 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import { Content } from '../../components/layout/Content';
|
||||
import { TPattern } from '../../components/common/TPattern';
|
||||
import { mockDocs } from '../../data';
|
||||
|
||||
export const DocsPage: React.FC = () => {
|
||||
const { theme, isDark } = useTheme();
|
||||
|
||||
return (
|
||||
<Content>
|
||||
<TPattern />
|
||||
{/* Upload Section */}
|
||||
<section style={{ marginBottom: 56 }}>
|
||||
<h2 style={{
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
marginBottom: 20,
|
||||
letterSpacing: '1px',
|
||||
}}>UPLOAD</h2>
|
||||
<div style={{
|
||||
border: `2px solid ${theme.border}`,
|
||||
borderRadius: 16,
|
||||
padding: 64,
|
||||
textAlign: 'center',
|
||||
background: theme.bgCard,
|
||||
transition: 'all 0.3s ease',
|
||||
cursor: 'pointer',
|
||||
boxShadow: !isDark ? '0 4px 16px rgba(226,0,116,0.08)' : 'none',
|
||||
}}>
|
||||
<div style={{
|
||||
width: 80,
|
||||
height: 80,
|
||||
borderRadius: 20,
|
||||
background: theme.bgHover,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: '0 auto 20px',
|
||||
}}>
|
||||
<svg width="36" height="36" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 4L12 16M12 4L7 9M12 4L17 9" stroke={theme.accent} strokeWidth="2" strokeLinecap="round"/>
|
||||
<path d="M4 18H20" stroke={theme.accent} strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div style={{ fontSize: 16, fontWeight: 500, marginBottom: 8 }}>拖拽文件或点击上传</div>
|
||||
<div className="mono" style={{ fontSize: 12, color: theme.text3 }}>PDF · DOCX · TXT · MAX 50MB</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Indexed Docs */}
|
||||
<section style={{ marginBottom: 56 }}>
|
||||
<h2 style={{
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
marginBottom: 20,
|
||||
letterSpacing: '1px',
|
||||
}}>INDEXED DOCUMENTS ({mockDocs.length})</h2>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{mockDocs.map(d => (
|
||||
<div key={d.id} style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: 20,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 12,
|
||||
border: `1px solid ${theme.border}`,
|
||||
transition: 'all 0.2s ease',
|
||||
boxShadow: !isDark ? '0 2px 8px rgba(226,0,116,0.04)' : 'none',
|
||||
}}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
|
||||
<div style={{
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 10,
|
||||
background: theme.bgHover,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M14 2H6C5 2 4 3 4 4V20C4 21 5 22 6 22H18C19 22 20 21 20 20V8L14 2Z" stroke={theme.accent} strokeWidth="1.5"/>
|
||||
<path d="M14 2V8H20" stroke={theme.accent} strokeWidth="1.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<div style={{ fontSize: 15, fontWeight: 500 }}>{d.name}</div>
|
||||
<div className="mono" style={{ fontSize: 11, color: theme.text3 }}>{d.size}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 20 }}>
|
||||
<div className="mono" style={{
|
||||
fontSize: 12,
|
||||
padding: '6px 12px',
|
||||
background: theme.bgHover,
|
||||
borderRadius: 6,
|
||||
color: theme.text2,
|
||||
}}>{d.chunks} chunks</div>
|
||||
<div style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.green,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M5 12L10 17L20 7" stroke="#fff" strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Processing Pipeline */}
|
||||
<section>
|
||||
<h2 style={{
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
marginBottom: 20,
|
||||
letterSpacing: '1px',
|
||||
}}>PROCESSING PIPELINE</h2>
|
||||
<div style={{ display: 'flex', gap: 16 }}>
|
||||
{[
|
||||
{ name: 'LOAD' },
|
||||
{ name: 'PARSE' },
|
||||
{ name: 'CHUNK' },
|
||||
{ name: 'EMBED' },
|
||||
{ name: 'STORE' },
|
||||
].map((s, i) => (
|
||||
<div key={i} style={{
|
||||
flex: 1,
|
||||
padding: 20,
|
||||
textAlign: 'center',
|
||||
background: theme.bgCard,
|
||||
borderRadius: 12,
|
||||
border: `1px solid ${theme.border}`,
|
||||
position: 'relative',
|
||||
boxShadow: !isDark ? '0 2px 8px rgba(226,0,116,0.04)' : 'none',
|
||||
}}>
|
||||
<div style={{
|
||||
width: 36,
|
||||
height: 36,
|
||||
borderRadius: 8,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: '0 auto 12px',
|
||||
fontSize: 16,
|
||||
color: '#fff',
|
||||
}}>✓</div>
|
||||
<div className="mono" style={{ fontSize: 12, fontWeight: 600 }}>{s.name}</div>
|
||||
{i < 4 && <div style={{
|
||||
position: 'absolute',
|
||||
right: -8,
|
||||
top: '50%',
|
||||
transform: 'translateY(-50%)',
|
||||
color: theme.borderLight,
|
||||
}}>→</div>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Content>
|
||||
);
|
||||
};
|
||||
1
src/pages/Docs/index.ts
Normal file
1
src/pages/Docs/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { DocsPage } from './DocsPage';
|
||||
603
src/pages/RagChat/RagChatPage.tsx
Normal file
603
src/pages/RagChat/RagChatPage.tsx
Normal file
@@ -0,0 +1,603 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import type { ChatMessage, RetrievalData } from '../../types';
|
||||
import { mockRetrievalData } from '../../data';
|
||||
|
||||
const ragQuickQuestions = [
|
||||
'电动自行车上路需要什么条件?',
|
||||
'驾驶证如何申请?',
|
||||
'超速行驶如何处罚?',
|
||||
'车辆年检有哪些规定?',
|
||||
];
|
||||
|
||||
const generateRagResponse = (question: string): { text: string; retrievalIds: number[] } => {
|
||||
const keywords: Record<string, { text: string; retrievalIds: number[] }> = {
|
||||
'电动自行车': {
|
||||
text: '根据《道路交通安全法》及相关规范,电动自行车上路需满足以下条件:\n1. 符合国家标准 GB17761-2018\n2. 经公安机关交通管理部门登记\n3. 最高设计车速不超过 25km/h\n4. 整车质量不超过 55kg\n5. 具有脚踏骑行能力',
|
||||
retrievalIds: [1, 2, 3],
|
||||
},
|
||||
'驾驶证': {
|
||||
text: '驾驶证申请流程如下:\n1. 到驾校报名并参加培训\n2. 通过科目一(理论考试)\n3. 通过科目二(场地驾驶技能考试)\n4. 通过科目三(道路驾驶技能考试)\n5. 通过科目四(安全文明驾驶常识考试)\n6. 领取驾驶证',
|
||||
retrievalIds: [1, 4],
|
||||
},
|
||||
'超速': {
|
||||
text: '超速处罚标准:\n- 超速10%以下:警告\n- 超速10%-20%:罚款50-200元\n- 超速20%-50%:罚款200-500元,记3-6分\n- 超速50%以上:罚款500-2000元,记12分,可吊销驾驶证',
|
||||
retrievalIds: [1, 2],
|
||||
},
|
||||
'年检': {
|
||||
text: '车辆年检规定:\n- 小型私家车:6年内免检(每2年申领标志),6-10年每2年检验,10年以上每年检验\n- 车辆需携带行驶证、交强险保单\n- 检验项目:灯光、制动、排放等',
|
||||
retrievalIds: [1, 4],
|
||||
},
|
||||
};
|
||||
|
||||
for (const [key, value] of Object.entries(keywords)) {
|
||||
if (question.includes(key)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
text: '抱歉,暂未找到与您问题直接相关的法规内容。请尝试更具体的问题,或联系交通管理部门获取详细信息。',
|
||||
retrievalIds: [],
|
||||
};
|
||||
};
|
||||
|
||||
export const RagChatPage: React.FC = () => {
|
||||
const { theme } = useTheme();
|
||||
const [messages, setMessages] = useState<ChatMessage[]>([]);
|
||||
const [retrievals, setRetrievals] = useState<RetrievalData[]>([]);
|
||||
const [input, setInput] = useState<string>('');
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [showClearConfirm, setShowClearConfirm] = useState<boolean>(false);
|
||||
const [selectedRetrieval, setSelectedRetrieval] = useState<RetrievalData | null>(null);
|
||||
|
||||
const sendMessage = (text: string) => {
|
||||
if (!text.trim()) return;
|
||||
|
||||
const userMsg = { id: Date.now(), role: 'user' as const, content: text };
|
||||
setMessages((prev) => [...prev, userMsg]);
|
||||
setInput('');
|
||||
setLoading(true);
|
||||
|
||||
setTimeout(() => {
|
||||
const response = generateRagResponse(text);
|
||||
const aiMsg = {
|
||||
id: Date.now() + 1,
|
||||
role: 'assistant' as const,
|
||||
content: response.text,
|
||||
retrievalIds: response.retrievalIds,
|
||||
};
|
||||
setMessages((prev) => [...prev, aiMsg]);
|
||||
setRetrievals(mockRetrievalData.filter((r) => response.retrievalIds.includes(r.id)));
|
||||
setLoading(false);
|
||||
}, 800);
|
||||
};
|
||||
|
||||
const clearMessages = () => {
|
||||
setMessages([]);
|
||||
setRetrievals([]);
|
||||
setShowClearConfirm(false);
|
||||
};
|
||||
|
||||
const regenerateLastAnswer = () => {
|
||||
if (messages.length < 2) return;
|
||||
const lastUserMsg = messages.filter((m) => m.role === 'user').pop();
|
||||
if (!lastUserMsg) return;
|
||||
|
||||
setLoading(true);
|
||||
setTimeout(() => {
|
||||
const response = generateRagResponse(lastUserMsg.content);
|
||||
const aiMsg = {
|
||||
id: Date.now(),
|
||||
role: 'assistant' as const,
|
||||
content: response.text,
|
||||
retrievalIds: response.retrievalIds,
|
||||
};
|
||||
setMessages((prev) => [...prev.slice(0, -1), aiMsg]);
|
||||
setRetrievals(mockRetrievalData.filter((r) => response.retrievalIds.includes(r.id)));
|
||||
setLoading(false);
|
||||
}, 800);
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
height: 'calc(100vh - 128px)',
|
||||
}}>
|
||||
{/* Left: Chat Area - 60% */}
|
||||
<div style={{
|
||||
flex: '0 0 60%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
borderRight: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
{/* Messages */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
overflowY: 'auto',
|
||||
padding: '24px 32px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 20,
|
||||
}}>
|
||||
{messages.length === 0 ? (
|
||||
<div style={{
|
||||
textAlign: 'center',
|
||||
padding: 60,
|
||||
color: theme.text3,
|
||||
}}>
|
||||
<div style={{
|
||||
width: 72,
|
||||
height: 72,
|
||||
borderRadius: 16,
|
||||
background: theme.bgCard,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: '0 auto 20px',
|
||||
border: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
<svg width="28" height="28" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" stroke={theme.accent} strokeWidth="1.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div style={{ fontSize: 15, fontWeight: 500, marginBottom: 6, color: theme.text }}>开始法规对话</div>
|
||||
<div className="mono" style={{ fontSize: 11 }}>选择快捷问题或输入您的问题</div>
|
||||
</div>
|
||||
) : (
|
||||
messages.map(msg => (
|
||||
<div key={msg.id} style={{
|
||||
display: 'flex',
|
||||
gap: 12,
|
||||
flexDirection: msg.role === 'user' ? 'row-reverse' : 'row',
|
||||
}}>
|
||||
{msg.role === 'assistant' && (
|
||||
<div style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
<div style={{
|
||||
maxWidth: '80%',
|
||||
padding: msg.role === 'user' ? '12px 18px' : '14px 18px',
|
||||
background: msg.role === 'user' ? theme.gradientAccent : theme.bgCard,
|
||||
borderRadius: 12,
|
||||
color: msg.role === 'user' ? '#fff' : theme.text,
|
||||
fontSize: 14,
|
||||
lineHeight: 1.6,
|
||||
whiteSpace: 'pre-wrap',
|
||||
border: msg.role === 'assistant' ? `1px solid ${theme.border}` : 'none',
|
||||
}}>
|
||||
{msg.content}
|
||||
{msg.role === 'assistant' && msg.retrievalIds && msg.retrievalIds.length > 0 && (
|
||||
<div style={{
|
||||
marginTop: 10,
|
||||
paddingTop: 10,
|
||||
borderTop: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 6,
|
||||
}}>
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M14 2H6C5 2 4 3 4 4V20C4 21 5 22 6 22H18C19 22 20 21 20 20V8L14 2Z" stroke={theme.accent} strokeWidth="1.5"/>
|
||||
</svg>
|
||||
<span className="mono" style={{ fontSize: 11, color: theme.accent }}>
|
||||
{msg.retrievalIds.length} 个法规引用
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
{loading && (
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<div style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
borderRadius: 8,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div style={{
|
||||
padding: '14px 18px',
|
||||
background: theme.bgCard,
|
||||
borderRadius: 12,
|
||||
border: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
}}>
|
||||
<div style={{
|
||||
width: 6,
|
||||
height: 6,
|
||||
borderRadius: '50%',
|
||||
background: theme.accent,
|
||||
animation: 'pulse 1s infinite',
|
||||
}} />
|
||||
<span style={{ fontSize: 13, color: theme.text2 }}>检索中...</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Input Area */}
|
||||
<div style={{
|
||||
padding: '16px 32px 20px',
|
||||
background: theme.bg,
|
||||
borderTop: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
{/* Quick Questions */}
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: 8,
|
||||
marginBottom: 12,
|
||||
flexWrap: 'wrap',
|
||||
}}>
|
||||
{ragQuickQuestions.map(q => (
|
||||
<button
|
||||
key={q}
|
||||
onClick={() => sendMessage(q)}
|
||||
style={{
|
||||
padding: '6px 14px',
|
||||
fontSize: 12,
|
||||
background: theme.bgCard,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 6,
|
||||
color: theme.text2,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>{q}</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Input Row */}
|
||||
<div style={{ display: 'flex', gap: 10 }}>
|
||||
<input
|
||||
value={input}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && sendMessage(input)}
|
||||
placeholder="输入法规问题..."
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: 12,
|
||||
fontSize: 14,
|
||||
background: theme.bgCard,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 8,
|
||||
color: theme.text,
|
||||
outline: 'none',
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
onClick={() => sendMessage(input)}
|
||||
disabled={loading || !input.trim()}
|
||||
style={{
|
||||
padding: '12px 24px',
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
background: loading || !input.trim() ? theme.bgHover : theme.gradientAccent,
|
||||
color: loading || !input.trim() ? theme.text3 : '#fff',
|
||||
border: 'none',
|
||||
borderRadius: 8,
|
||||
cursor: loading || !input.trim() ? 'not-allowed' : 'pointer',
|
||||
}}
|
||||
>发送</button>
|
||||
{messages.length > 0 && (
|
||||
<button
|
||||
onClick={() => setShowClearConfirm(true)}
|
||||
style={{
|
||||
padding: '12px 16px',
|
||||
fontSize: 13,
|
||||
background: theme.bgCard,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 8,
|
||||
color: theme.text2,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>清空</button>
|
||||
)}
|
||||
{messages.filter(m => m.role === 'assistant').length > 0 && (
|
||||
<button
|
||||
onClick={regenerateLastAnswer}
|
||||
disabled={loading}
|
||||
style={{
|
||||
padding: '12px 16px',
|
||||
fontSize: 13,
|
||||
background: theme.bgCard,
|
||||
border: `1px solid ${theme.border}`,
|
||||
borderRadius: 8,
|
||||
color: theme.text2,
|
||||
cursor: loading ? 'not-allowed' : 'pointer',
|
||||
}}
|
||||
>重生成</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right: Retrieval Area - 40% */}
|
||||
<div style={{
|
||||
flex: '0 0 40%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
background: theme.bgCard,
|
||||
}}>
|
||||
{/* Retrieval Header */}
|
||||
<div style={{
|
||||
padding: '20px 24px',
|
||||
borderBottom: `1px solid ${theme.border}`,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 10,
|
||||
}}>
|
||||
<div style={{
|
||||
width: 28,
|
||||
height: 28,
|
||||
borderRadius: 6,
|
||||
background: theme.gradientAccent,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M14 2H6C5 2 4 3 4 4V20C4 21 5 22 6 22H18C19 22 20 21 20 20V8L14 2Z" stroke="#fff" strokeWidth="1.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span className="mono" style={{ fontSize: 12, fontWeight: 600, color: theme.accent, letterSpacing: '1px' }}>
|
||||
RETRIEVED FRAGMENTS
|
||||
</span>
|
||||
{retrievals.length > 0 && (
|
||||
<span className="mono" style={{
|
||||
fontSize: 11,
|
||||
padding: '4px 10px',
|
||||
background: theme.bgHover,
|
||||
borderRadius: 4,
|
||||
color: theme.text3,
|
||||
}}>{retrievals.length}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Retrieval List */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
overflowY: 'auto',
|
||||
padding: '16px 24px',
|
||||
}}>
|
||||
{retrievals.length > 0 ? (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{retrievals.map((r, i) => (
|
||||
<div
|
||||
key={r.id}
|
||||
onClick={() => setSelectedRetrieval(r)}
|
||||
style={{
|
||||
padding: 16,
|
||||
background: theme.bgHover,
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${theme.border}`,
|
||||
cursor: 'pointer',
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
{/* Left accent bar */}
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 16,
|
||||
bottom: 16,
|
||||
width: 3,
|
||||
background: theme.gradientAccent,
|
||||
borderRadius: 2,
|
||||
}} />
|
||||
<div style={{ paddingLeft: 8 }}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
marginBottom: 8,
|
||||
}}>
|
||||
<span className="mono" style={{ fontSize: 11, fontWeight: 700, color: theme.accent }}>#{i + 1}</span>
|
||||
<span className="mono" style={{
|
||||
fontSize: 11,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
}}>{(r.score * 100).toFixed(0)}%</span>
|
||||
</div>
|
||||
<div style={{ fontSize: 13, fontWeight: 500, marginBottom: 4, color: theme.text }}>{r.file}</div>
|
||||
<div className="mono" style={{ fontSize: 11, color: theme.text3, marginBottom: 8 }}>{r.clause}</div>
|
||||
<div style={{
|
||||
fontSize: 12,
|
||||
color: theme.text2,
|
||||
lineHeight: 1.5,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
}}>{r.content}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div style={{
|
||||
textAlign: 'center',
|
||||
padding: 40,
|
||||
color: theme.text3,
|
||||
}}>
|
||||
<div style={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: 10,
|
||||
background: theme.bgHover,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: '0 auto 16px',
|
||||
}}>
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M14 2H6C5 2 4 3 4 4V20C4 21 5 22 6 22H18C19 22 20 21 20 20V8L14 2Z" stroke={theme.text3} strokeWidth="1.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div className="mono" style={{ fontSize: 11 }}>对话后显示相关法规</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Clear Confirm Modal */}
|
||||
{showClearConfirm && (
|
||||
<div style={{
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
background: 'rgba(0,0,0,0.6)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
zIndex: 1000,
|
||||
}}>
|
||||
<div style={{
|
||||
padding: 24,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 16,
|
||||
maxWidth: 400,
|
||||
border: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
<div style={{ fontSize: 15, fontWeight: 600, marginBottom: 12, color: theme.text }}>确定清空对话?</div>
|
||||
<div style={{ fontSize: 13, color: theme.text2, marginBottom: 20 }}>此操作不可恢复</div>
|
||||
<div style={{ display: 'flex', gap: 10, justifyContent: 'flex-end' }}>
|
||||
<button
|
||||
onClick={() => setShowClearConfirm(false)}
|
||||
style={{
|
||||
padding: '10px 18px',
|
||||
fontSize: 13,
|
||||
background: theme.bgHover,
|
||||
border: 'none',
|
||||
borderRadius: 8,
|
||||
color: theme.text2,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>取消</button>
|
||||
<button
|
||||
onClick={clearMessages}
|
||||
style={{
|
||||
padding: '10px 18px',
|
||||
fontSize: 13,
|
||||
fontWeight: 600,
|
||||
background: theme.accent,
|
||||
border: 'none',
|
||||
borderRadius: 8,
|
||||
color: '#fff',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Retrieval Detail Modal */}
|
||||
{selectedRetrieval && (
|
||||
<div
|
||||
onClick={() => setSelectedRetrieval(null)}
|
||||
style={{
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
background: 'rgba(0,0,0,0.6)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
style={{
|
||||
width: 520,
|
||||
maxWidth: '90%',
|
||||
maxHeight: '80%',
|
||||
padding: 24,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 16,
|
||||
border: `1px solid ${theme.accent}`,
|
||||
boxShadow: '0 8px 32px rgba(0,0,0,0.3)',
|
||||
}}
|
||||
>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
marginBottom: 16,
|
||||
}}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
<div style={{
|
||||
padding: '4px 10px',
|
||||
background: theme.gradientAccent,
|
||||
borderRadius: 6,
|
||||
}}>
|
||||
<span className="mono" style={{ fontSize: 11, fontWeight: 600, color: '#fff' }}>
|
||||
{(selectedRetrieval.score * 100).toFixed(0)}%
|
||||
</span>
|
||||
</div>
|
||||
<span style={{ fontSize: 14, fontWeight: 600, color: theme.text }}>{selectedRetrieval.file}</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setSelectedRetrieval(null)}
|
||||
style={{
|
||||
width: 28,
|
||||
height: 28,
|
||||
background: theme.bgHover,
|
||||
border: 'none',
|
||||
borderRadius: 6,
|
||||
cursor: 'pointer',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
}}
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M18 6L6 18M6 6L18 18" stroke={theme.text3} strokeWidth="2" strokeLinecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div style={{
|
||||
padding: '10px 14px',
|
||||
background: theme.bgHover,
|
||||
borderRadius: 8,
|
||||
marginBottom: 16,
|
||||
}}>
|
||||
<span className="mono" style={{ fontSize: 12, color: theme.accent }}>{selectedRetrieval.clause}</span>
|
||||
</div>
|
||||
<div style={{
|
||||
fontSize: 14,
|
||||
lineHeight: 1.7,
|
||||
color: theme.text2,
|
||||
whiteSpace: 'pre-wrap',
|
||||
}}>{selectedRetrieval.content}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
1
src/pages/RagChat/index.ts
Normal file
1
src/pages/RagChat/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { RagChatPage } from './RagChatPage';
|
||||
138
src/pages/Status/StatusPage.tsx
Normal file
138
src/pages/Status/StatusPage.tsx
Normal file
@@ -0,0 +1,138 @@
|
||||
import React from 'react';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import { Content } from '../../components/layout/Content';
|
||||
import { TPattern } from '../../components/common/TPattern';
|
||||
import { mockDocs } from '../../data';
|
||||
|
||||
const StatsCard = ({ label, value, accent = false }: {
|
||||
label: string;
|
||||
value: number;
|
||||
accent?: boolean;
|
||||
}) => {
|
||||
const { theme, isDark } = useTheme();
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
padding: 20,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 12,
|
||||
border: `1px solid ${accent ? theme.accent : theme.border}`,
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
boxShadow: !isDark ? '0 2px 8px rgba(226,0,116,0.06)' : 'none',
|
||||
}}>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 3,
|
||||
background: theme.gradientAccent,
|
||||
}} />
|
||||
<div className="mono" style={{ fontSize: 11, color: theme.text3, marginBottom: 8, letterSpacing: '1px' }}>{label}</div>
|
||||
<div className="mono" style={{ fontSize: 32, fontWeight: 700, color: accent ? theme.accent : theme.text }}>{value}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const StatusPage: React.FC = () => {
|
||||
const { theme, isDark } = useTheme();
|
||||
|
||||
return (
|
||||
<Content>
|
||||
<TPattern />
|
||||
{/* System Stats */}
|
||||
<section style={{ marginBottom: 48 }}>
|
||||
<div style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(4, 1fr)',
|
||||
gap: 16,
|
||||
}}>
|
||||
<StatsCard label="DOCUMENTS" value={3} />
|
||||
<StatsCard label="CHUNKS" value={214} />
|
||||
<StatsCard label="DIMENSIONS" value={1536} />
|
||||
<StatsCard label="CLAUSES" value={214} accent />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Configuration */}
|
||||
<section style={{ marginBottom: 48 }}>
|
||||
<h2 style={{
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
marginBottom: 20,
|
||||
letterSpacing: '1px',
|
||||
}}>SYSTEM CONFIGURATION</h2>
|
||||
<div style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr',
|
||||
gap: 12,
|
||||
}}>
|
||||
{[
|
||||
['LLM Model', 'GPT-4o'],
|
||||
['Embedding', 'text-embedding-3-small'],
|
||||
['Vector DB', 'ChromaDB'],
|
||||
['Retrieval', 'Hybrid (Vector + BM25)'],
|
||||
['Top-K', '5 candidates'],
|
||||
['Chunk Size', '500-1000 tokens'],
|
||||
['Overlap', '100 tokens'],
|
||||
['Temperature', '0.1'],
|
||||
].map(([k, v]) => (
|
||||
<div key={k} style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
padding: 16,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${theme.border}`,
|
||||
boxShadow: !isDark ? '0 2px 8px rgba(226,0,116,0.04)' : 'none',
|
||||
}}>
|
||||
<span className="mono" style={{ fontSize: 12, color: theme.text3 }}>{k}</span>
|
||||
<span style={{ fontSize: 14, fontWeight: 500 }}>{v}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Indexed Docs Overview */}
|
||||
<section>
|
||||
<h2 style={{
|
||||
fontSize: 14,
|
||||
fontWeight: 600,
|
||||
color: theme.accent,
|
||||
marginBottom: 20,
|
||||
letterSpacing: '1px',
|
||||
}}>DOCUMENT INDEX</h2>
|
||||
{mockDocs.map(d => (
|
||||
<div key={d.id} style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: 16,
|
||||
background: theme.bgCard,
|
||||
borderRadius: 10,
|
||||
marginBottom: 10,
|
||||
border: `1px solid ${theme.border}`,
|
||||
}}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<span style={{ fontSize: 14 }}>{d.name}</span>
|
||||
<span className="mono" style={{ fontSize: 11, color: theme.text3 }}>{d.size}</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
|
||||
<span className="mono" style={{ fontSize: 12, color: theme.text2 }}>{d.chunks} chunks</span>
|
||||
<div style={{
|
||||
padding: '4px 12px',
|
||||
background: theme.green,
|
||||
borderRadius: 6,
|
||||
}}>
|
||||
<span className="mono" style={{ fontSize: 10, fontWeight: 600, color: '#fff' }}>INDEXED</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
</Content>
|
||||
);
|
||||
};
|
||||
1
src/pages/Status/index.ts
Normal file
1
src/pages/Status/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { StatusPage } from './StatusPage';
|
||||
244
src/styles/globals.css
Normal file
244
src/styles/globals.css
Normal file
@@ -0,0 +1,244 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=TeleNeo:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* Light mode (default) */
|
||||
:root {
|
||||
--t-bg: #ffffff;
|
||||
--t-bg-card: #ffffff;
|
||||
--t-bg-hover: #f8f8fc;
|
||||
--t-bg-elevated: #fafafa;
|
||||
--t-border: #e8e8f0;
|
||||
--t-border-light: #d0d0d8;
|
||||
--t-text: #1a1a2e;
|
||||
--t-text2: #4a4a5a;
|
||||
--t-text3: #7a7a8a;
|
||||
--t-green: #00b89c;
|
||||
--t-orange: #ff7700;
|
||||
--t-accent-glow: rgba(226,0,116,0.08);
|
||||
--t-pattern-opacity: 0.04;
|
||||
}
|
||||
|
||||
/* Dark mode */
|
||||
.dark {
|
||||
--t-bg: #0a0a12;
|
||||
--t-bg-card: #12121f;
|
||||
--t-bg-hover: #1a1a2e;
|
||||
--t-bg-elevated: #1e1e30;
|
||||
--t-border: #2a2a40;
|
||||
--t-border-light: #4a4a60;
|
||||
--t-text: #ffffff;
|
||||
--t-text2: #c0c0d0;
|
||||
--t-text3: #9a9aaa;
|
||||
--t-green: #00d4aa;
|
||||
--t-orange: #ff8800;
|
||||
--t-accent-glow: rgba(226,0,116,0.12);
|
||||
--t-pattern-opacity: 0.03;
|
||||
}
|
||||
|
||||
/* Base styles */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html, body, #root {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'TeleNeo', 'Segoe UI', system-ui, sans-serif;
|
||||
overflow-x: hidden;
|
||||
font-feature-settings: 'kern' 1;
|
||||
color: #1a1a2e;
|
||||
background: #ffffff;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
/* Dark mode body */
|
||||
.dark body,
|
||||
body.dark-mode {
|
||||
color: #fff;
|
||||
background: #0a0a12;
|
||||
}
|
||||
|
||||
/* Selection */
|
||||
::selection {
|
||||
background: rgba(226, 0, 116, 0.3);
|
||||
}
|
||||
|
||||
/* Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(180deg, #e20074, #be0060);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Monospace font class */
|
||||
.mono {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
}
|
||||
|
||||
/* Smooth transitions for theme */
|
||||
* {
|
||||
transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
|
||||
}
|
||||
|
||||
/* Exclude buttons from auto-transition for custom hover effects */
|
||||
button, input {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/* T-Systems Button Style */
|
||||
.t-btn,
|
||||
.t-btn:hover {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.t-btn {
|
||||
background: linear-gradient(135deg, #e20074 0%, #be0060 100%);
|
||||
}
|
||||
|
||||
.t-btn:hover {
|
||||
background: linear-gradient(135deg, #f0208a 0%, #d01070 100%);
|
||||
box-shadow: 0 4px 20px rgba(226,0,116,0.4);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* T-Systems Gradient Background */
|
||||
.t-gradient-bg {
|
||||
background: linear-gradient(135deg, #0a0a12 0%, #1a1a2e 50%, #0a0a12 100%);
|
||||
}
|
||||
|
||||
/* Magenta Glow */
|
||||
.magenta-glow {
|
||||
box-shadow: 0 0 20px rgba(226,0,116,0.15), 0 0 40px rgba(226,0,116,0.05);
|
||||
}
|
||||
|
||||
/* Card gradient for dark mode */
|
||||
.dark .t-card-gradient {
|
||||
background: linear-gradient(180deg, #12121f, #0a0a12);
|
||||
}
|
||||
|
||||
/* Card gradient for light mode */
|
||||
:not(.dark) .t-card-gradient {
|
||||
background: linear-gradient(180deg, #ffffff, #fafafa);
|
||||
}
|
||||
|
||||
/* Light mode shadow for cards */
|
||||
:not(.dark) .t-card-shadow {
|
||||
box-shadow: 0 2px 8px rgba(226,0,116,0.04);
|
||||
}
|
||||
|
||||
:not(.dark) .t-card-shadow-lg {
|
||||
box-shadow: 0 4px 16px rgba(226,0,116,0.08);
|
||||
}
|
||||
|
||||
/* Accent glow */
|
||||
.t-accent-glow {
|
||||
box-shadow: 0 0 12px rgba(226,0,116,0.5), 0 0 24px rgba(226,0,116,0.2);
|
||||
}
|
||||
|
||||
/* High risk glow */
|
||||
.t-risk-high-glow {
|
||||
box-shadow: 0 0 8px rgba(255,68,68,0.3);
|
||||
}
|
||||
|
||||
/* Medium risk glow */
|
||||
.t-risk-medium-glow {
|
||||
box-shadow: 0 0 6px rgba(255,136,0,0.2);
|
||||
}
|
||||
|
||||
/* Low risk glow */
|
||||
.t-risk-low-glow {
|
||||
box-shadow: 0 0 4px rgba(0,212,170,0.15);
|
||||
}
|
||||
|
||||
/* Pulse glow animation */
|
||||
@keyframes pulse-glow {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 12px rgba(226,0,116,0.5), 0 0 24px rgba(226,0,116,0.2);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 16px rgba(226,0,116,0.7), 0 0 32px rgba(226,0,116,0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-pulse-glow {
|
||||
animation: pulse-glow 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-glow {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 12px rgba(226,0,116,0.5), 0 0 24px rgba(226,0,116,0.2);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 16px rgba(226,0,116,0.7), 0 0 32px rgba(226,0,116,0.3);
|
||||
}
|
||||
}
|
||||
|
||||
/* Slide up animation */
|
||||
@keyframes slideUp {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slide-up {
|
||||
animation: slideUp 0.3s ease;
|
||||
}
|
||||
|
||||
/* Slide in animation */
|
||||
@keyframes slideIn {
|
||||
0% {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slide-in {
|
||||
animation: slideIn 0.3s ease-out forwards;
|
||||
}
|
||||
|
||||
/* Slide out animation */
|
||||
@keyframes slideOut {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slide-out {
|
||||
animation: slideOut 0.3s ease-in forwards;
|
||||
}
|
||||
|
||||
/* Custom utility classes */
|
||||
@layer utilities {
|
||||
.gradient-accent {
|
||||
background: linear-gradient(135deg, #e20074 0%, #be0060 100%);
|
||||
}
|
||||
|
||||
.gradient-accent-hover {
|
||||
background: linear-gradient(135deg, #f0208a 0%, #d01070 100%);
|
||||
}
|
||||
}
|
||||
58
src/types/compliance.ts
Normal file
58
src/types/compliance.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
// Compliance types
|
||||
export type RiskLevel = 'high' | 'medium' | 'low';
|
||||
export type ComplianceStatus = 'pass' | 'warning' | 'fail';
|
||||
export type RegulationCategory = 'high' | 'medium' | 'low';
|
||||
|
||||
export interface Regulation {
|
||||
id: number;
|
||||
name: string;
|
||||
clause: string;
|
||||
score: number;
|
||||
matchKeyword: string;
|
||||
category: RegulationCategory;
|
||||
fullContent: string;
|
||||
}
|
||||
|
||||
export interface ComplianceChunk {
|
||||
id: number;
|
||||
index: number;
|
||||
intent: string;
|
||||
startPos: number;
|
||||
endPos: number;
|
||||
content: string;
|
||||
regulations: Regulation[];
|
||||
}
|
||||
|
||||
export interface SegmentRisk {
|
||||
chunkId: number;
|
||||
level: RiskLevel;
|
||||
score: number;
|
||||
highRegsCount: number;
|
||||
riskRegs: number;
|
||||
}
|
||||
|
||||
export interface RiskDashboardData {
|
||||
score: number;
|
||||
highRiskCount: number;
|
||||
mediumRiskCount: number;
|
||||
lowRiskCount: number;
|
||||
needFixSegments: number;
|
||||
status: ComplianceStatus;
|
||||
statusLabel: string;
|
||||
segmentRisks: SegmentRisk[];
|
||||
}
|
||||
|
||||
export interface PriorityAction {
|
||||
id: number;
|
||||
regulation: string;
|
||||
issue: string;
|
||||
suggestion: string;
|
||||
chunkId: number;
|
||||
severity: 'high' | 'medium';
|
||||
}
|
||||
|
||||
// Upload document type
|
||||
export interface UploadedDoc {
|
||||
name: string;
|
||||
size: string;
|
||||
}
|
||||
34
src/types/doc.ts
Normal file
34
src/types/doc.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
// Document types
|
||||
export interface Doc {
|
||||
id: number;
|
||||
name: string;
|
||||
chunks: number;
|
||||
size: string;
|
||||
status: 'indexed' | 'parsing' | 'pending';
|
||||
}
|
||||
|
||||
// Search result types
|
||||
export interface SearchResult {
|
||||
id: number;
|
||||
score: number;
|
||||
law: string;
|
||||
preview: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
// Chat message types
|
||||
export interface ChatMessage {
|
||||
id: number;
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
retrievalIds?: number[];
|
||||
}
|
||||
|
||||
// Retrieval data types
|
||||
export interface RetrievalData {
|
||||
id: number;
|
||||
file: string;
|
||||
clause: string;
|
||||
score: number;
|
||||
content: string;
|
||||
}
|
||||
4
src/types/index.ts
Normal file
4
src/types/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Re-export all types
|
||||
export * from './theme';
|
||||
export * from './doc';
|
||||
export * from './compliance';
|
||||
56
src/types/theme.ts
Normal file
56
src/types/theme.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
// Theme types
|
||||
export type ThemeMode = 'dark' | 'light';
|
||||
|
||||
export interface ThemeColors {
|
||||
bg: string;
|
||||
bgCard: string;
|
||||
bgHover: string;
|
||||
bgElevated: string;
|
||||
border: string;
|
||||
borderLight: string;
|
||||
text: string;
|
||||
text2: string;
|
||||
text3: string;
|
||||
accent: string;
|
||||
accentDark: string;
|
||||
accentLight: string;
|
||||
green: string;
|
||||
orange: string;
|
||||
gradientAccent: string;
|
||||
}
|
||||
|
||||
export const darkTheme: ThemeColors = {
|
||||
bg: '#0a0a12',
|
||||
bgCard: '#12121f',
|
||||
bgHover: '#1a1a2e',
|
||||
bgElevated: '#1e1e30',
|
||||
border: '#2a2a40',
|
||||
borderLight: '#4a4a60',
|
||||
text: '#fff',
|
||||
text2: '#c0c0d0',
|
||||
text3: '#9a9aaa',
|
||||
accent: '#e20074',
|
||||
accentDark: '#be0060',
|
||||
accentLight: '#f04090',
|
||||
green: '#00d4aa',
|
||||
orange: '#ff8800',
|
||||
gradientAccent: 'linear-gradient(135deg, #e20074, #be0060)',
|
||||
};
|
||||
|
||||
export const lightTheme: ThemeColors = {
|
||||
bg: '#ffffff',
|
||||
bgCard: '#ffffff',
|
||||
bgHover: '#f8f8fc',
|
||||
bgElevated: '#fafafa',
|
||||
border: '#e8e8f0',
|
||||
borderLight: '#d0d0d8',
|
||||
text: '#1a1a2e',
|
||||
text2: '#4a4a5a',
|
||||
text3: '#7a7a8a',
|
||||
accent: '#e20074',
|
||||
accentDark: '#be0060',
|
||||
accentLight: '#f04090',
|
||||
green: '#00b89c',
|
||||
orange: '#ff7700',
|
||||
gradientAccent: 'linear-gradient(135deg, #e20074, #be0060)',
|
||||
};
|
||||
71
tailwind.config.js
Normal file
71
tailwind.config.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [
|
||||
"./index.html",
|
||||
"./src/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
// 动态主题色(通过CSS变量)
|
||||
't-bg': 'var(--t-bg)',
|
||||
't-bg-card': 'var(--t-bg-card)',
|
||||
't-bg-hover': 'var(--t-bg-hover)',
|
||||
't-bg-elevated': 'var(--t-bg-elevated)',
|
||||
't-border': 'var(--t-border)',
|
||||
't-border-light': 'var(--t-border-light)',
|
||||
't-text': 'var(--t-text)',
|
||||
't-text2': 'var(--t-text2)',
|
||||
't-text3': 'var(--t-text3)',
|
||||
// 固定品牌色
|
||||
't-accent': '#e20074',
|
||||
't-accent-dark': '#be0060',
|
||||
't-accent-light': '#f04090',
|
||||
// 动态状态色
|
||||
't-green': 'var(--t-green)',
|
||||
't-orange': 'var(--t-orange)',
|
||||
't-red': '#ff4444',
|
||||
},
|
||||
fontFamily: {
|
||||
'tele': ['TeleNeo', 'Segoe UI', 'system-ui', 'sans-serif'],
|
||||
'mono': ['JetBrains Mono', 'monospace'],
|
||||
},
|
||||
boxShadow: {
|
||||
't-glow': '0 0 20px rgba(226,0,116,0.15), 0 0 40px rgba(226,0,116,0.05)',
|
||||
't-card': '0 2px 8px rgba(226,0,116,0.04)',
|
||||
't-card-hover': '0 4px 16px rgba(226,0,116,0.08)',
|
||||
't-accent': '0 4px 20px rgba(226,0,116,0.4)',
|
||||
},
|
||||
keyframes: {
|
||||
'pulse-glow': {
|
||||
'0%, 100%': {
|
||||
boxShadow: '0 0 12px rgba(226,0,116,0.5), 0 0 24px rgba(226,0,116,0.2)'
|
||||
},
|
||||
'50%': {
|
||||
boxShadow: '0 0 16px rgba(226,0,116,0.7), 0 0 32px rgba(226,0,116,0.3)'
|
||||
},
|
||||
},
|
||||
'slideUp': {
|
||||
'0%': { opacity: '0', transform: 'translateY(10px)' },
|
||||
'100%': { opacity: '1', transform: 'translateY(0)' },
|
||||
},
|
||||
'slideIn': {
|
||||
'0%': { transform: 'translateX(100%)' },
|
||||
'100%': { transform: 'translateX(0)' },
|
||||
},
|
||||
'slideOut': {
|
||||
'0%': { transform: 'translateX(0)' },
|
||||
'100%': { transform: 'translateX(100%)' },
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
'pulse-glow': 'pulse-glow 2s infinite',
|
||||
'slide-up': 'slideUp 0.3s ease',
|
||||
'slide-in': 'slideIn 0.3s ease-out',
|
||||
'slide-out': 'slideOut 0.3s ease-in',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
25
tsconfig.app.json
Normal file
25
tsconfig.app.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "es2023",
|
||||
"lib": ["ES2023", "DOM"],
|
||||
"module": "esnext",
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
tsconfig.json
Normal file
7
tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
24
tsconfig.node.json
Normal file
24
tsconfig.node.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "es2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "esnext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
7
vite.config.ts
Normal file
7
vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
||||
Reference in New Issue
Block a user