create-react-docs-ui 0.5.5 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-react-docs-ui",
3
- "version": "0.5.5",
3
+ "version": "0.6.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "react": "^19.0.0",
13
- "react-docs-ui": "^0.5.5",
13
+ "react-docs-ui": "^0.6.1",
14
14
  "react-dom": "^19.0.0",
15
15
  "react-router-dom": "^7.8.0"
16
16
  },
@@ -205,3 +205,6 @@ contextMenu:
205
205
  mdx:
206
206
  componentsPath: "/src/components" # Component scan path
207
207
  enabled: true # Enable MDX support
208
+
209
+ ai:
210
+ enabled: true
@@ -204,3 +204,6 @@ contextMenu:
204
204
  mdx:
205
205
  componentsPath: "/src/components" # 组件扫描路径
206
206
  enabled: true # 启用 MDX 支持
207
+
208
+ ai:
209
+ enabled: true
@@ -1,15 +1,49 @@
1
1
  // @ts-nocheck
2
+ import path from "path"
2
3
  import react from "@vitejs/plugin-react"
3
4
  import { defineConfig } from "vite"
4
5
  import { mdxComponentsPlugin } from "./vite-plugin-mdx-components"
5
6
 
7
+ function publicHmrPlugin() {
8
+ return {
9
+ name: 'public-hmr',
10
+ configureServer(server) {
11
+ const publicDir = path.resolve(__dirname, 'public')
12
+ const configDir = path.resolve(publicDir, 'config')
13
+ const docsDir = path.resolve(publicDir, 'docs')
14
+
15
+ server.watcher.add([configDir, docsDir])
16
+
17
+ const isTargetFile = (file) => {
18
+ const relativePath = path.relative(publicDir, file)
19
+ return (
20
+ relativePath.startsWith('config' + path.sep) && file.endsWith('.yaml')
21
+ ) || (
22
+ relativePath.startsWith('docs' + path.sep) &&
23
+ (file.endsWith('.md') || file.endsWith('.mdx'))
24
+ )
25
+ }
26
+
27
+ const triggerReload = (file) => {
28
+ if (isTargetFile(file)) {
29
+ server.ws.send({ type: 'full-reload', path: '*' })
30
+ }
31
+ }
32
+
33
+ server.watcher.on('change', triggerReload)
34
+ server.watcher.on('add', triggerReload)
35
+ }
36
+ }
37
+ }
38
+
6
39
  export default defineConfig({
7
40
  plugins: [
8
41
  react(),
9
42
  mdxComponentsPlugin({
10
43
  componentsPath: './src/components',
11
44
  outputPath: './src/generated/mdx-components.ts'
12
- })
45
+ }),
46
+ publicHmrPlugin()
13
47
  ],
14
48
  resolve: {
15
49
  alias: {
@@ -1,60 +0,0 @@
1
- {
2
- "enabled": true,
3
- "provider": "openai",
4
- "systemPrompt": "你是一个专业的文档助手,请根据用户的问题,提供准确的答案。",
5
- "models": {
6
- "openai": {
7
- "modelId": "gpt-3.5-turbo",
8
- "apiKey": "",
9
- "baseUrl": "https://api.openai.com/v1",
10
- "maxTokens": 4000,
11
- "temperature": 0.7
12
- },
13
- "claude": {
14
- "modelId": "claude-3-sonnet-20240229",
15
- "apiKey": "",
16
- "baseUrl": "https://api.anthropic.com",
17
- "maxTokens": 4000,
18
- "temperature": 0.7
19
- },
20
- "gemini": {
21
- "modelId": "gemini-pro",
22
- "apiKey": "",
23
- "baseUrl": "https://generativelanguage.googleapis.com/v1",
24
- "maxTokens": 4000,
25
- "temperature": 0.7
26
- },
27
- "deepseek-v3": {
28
- "modelId": "deepseek-chat",
29
- "apiKey": "",
30
- "baseUrl": "https://api.deepseek.com",
31
- "maxTokens": 4000,
32
- "temperature": 0.7
33
- },
34
- "deepseek-reasoner": {
35
- "modelId": "deepseek-reasoner",
36
- "apiKey": "",
37
- "baseUrl": "https://api.deepseek.com",
38
- "maxTokens": 4000,
39
- "temperature": 0.7
40
- },
41
- "custom": {
42
- "modelId": "",
43
- "apiKey": "",
44
- "baseUrl": "",
45
- "maxTokens": 4000,
46
- "temperature": 0.7
47
- }
48
- },
49
- "features": {
50
- "chatAssistant": true,
51
- "documentSummary": true,
52
- "codeExplanation": true,
53
- "searchEnhancement": false
54
- },
55
- "ui": {
56
- "position": "bottom-right",
57
- "theme": "auto",
58
- "size": "medium"
59
- }
60
- }