@alauda/doom 1.13.3 → 1.14.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/lib/cli/new.js CHANGED
@@ -128,9 +128,7 @@ export const newCommand = new Command('new')
128
128
  });
129
129
  const files = new Set(dirents
130
130
  .filter((d) => d.isFile())
131
- .map((d) => path.relative(source, path.resolve(d.parentPath ||
132
- // eslint-disable-next-line @typescript-eslint/no-deprecated
133
- d.path, d.name))));
131
+ .map((d) => path.relative(source, path.resolve(d.parentPath, d.name))));
134
132
  for (const matcher of layout.matchers || []) {
135
133
  const matched = await glob(matcher.match.map((m) => render(m, { parameters })), { cwd: source });
136
134
  for (const file of matched) {
@@ -206,7 +206,7 @@ export const translate = async ({ source, sourceContent, target, systemPrompt, u
206
206
  endpoint: process.env.AZURE_OPENAI_ENDPOINT ||
207
207
  'https://azure-ai-api-gateway.alauda.cn',
208
208
  apiKey: process.env.AZURE_OPENAI_API_KEY,
209
- apiVersion: process.env.OPENAI_API_VERSION || '2025-03-01-preview',
209
+ apiVersion: process.env.OPENAI_API_VERSION || '2025-04-01-preview',
210
210
  });
211
211
  }
212
212
  const sourceLang = Language[source];
@@ -234,7 +234,7 @@ export const translate = async ({ source, sourceContent, target, systemPrompt, u
234
234
  isChunk,
235
235
  }, { async: true });
236
236
  logger.debug('Final system prompt:\n', finalSystemPrompt);
237
- const { choices } = await openai.chat.completions.parse({
237
+ const stream = await openai.chat.completions.create({
238
238
  messages: [
239
239
  {
240
240
  role: 'system',
@@ -247,10 +247,11 @@ export const translate = async ({ source, sourceContent, target, systemPrompt, u
247
247
  ],
248
248
  model: openaiModel,
249
249
  temperature: 0.2,
250
+ stream: true,
250
251
  });
251
- const { content, refusal } = choices[0].message;
252
- if (refusal) {
253
- throw new Error(refusal);
252
+ let content = '';
253
+ for await (const chunk of stream) {
254
+ content += chunk.choices[0].delta.content ?? '';
254
255
  }
255
256
  return restoreAnchors(content, anchors);
256
257
  };
@@ -8,7 +8,11 @@ import { AIAssistant } from "./AIAssistant/index.js";
8
8
  import { CloudAuthProvider } from "./context.js";
9
9
  import assistantIcon from '@alauda/doom/assets/assistant.svg';
10
10
  import { useMemoizedFn, useTranslation } from '@alauda/doom/runtime';
11
- const ALLOWED_DOMAINS = new Set(['docs-dev.alauda.cn', 'docs.alauda.io']);
11
+ const ALLOWED_DOMAINS = new Set([
12
+ 'docs-dev.alauda.cn',
13
+ 'docs.alauda.cn',
14
+ 'docs.alauda.io',
15
+ ]);
12
16
  if (!isProduction()) {
13
17
  ALLOWED_DOMAINS.add('localhost');
14
18
  }
@@ -86,7 +86,7 @@ const VersionsNav_ = () => {
86
86
  });
87
87
  const newNavMenu = getNavMenu();
88
88
  if (newNavMenu !== navMenu) {
89
- // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
89
+ // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect, react-hooks/set-state-in-effect
90
90
  setNavMenu(newNavMenu);
91
91
  }
92
92
  else if (navMenu.parentNode) {
@@ -79,6 +79,7 @@ export const OpenAPIRef = ({ schema, openapiPath: openapiPath_, isCommonRef = tr
79
79
  else if (!uid) {
80
80
  uid = innerUid;
81
81
  }
82
+ // eslint-disable-next-line react-hooks/preserve-manual-memoization
82
83
  const [schemaItem, openapi, openapiPath] = useMemo(() => {
83
84
  for (const [pathname, openapi] of Object.entries(openapisMap)) {
84
85
  if (openapiPath_ && pathname !== openapiPath_) {
@@ -2,6 +2,7 @@ import { useEffect, useRef } from 'react';
2
2
  export function useInterval(cb, delay) {
3
3
  const cbRef = useRef(cb);
4
4
  // Remember the latest callback.
5
+ // eslint-disable-next-line react-hooks/refs
5
6
  cbRef.current = cb;
6
7
  // Set up the interval.
7
8
  useEffect(() => {
@@ -14,10 +14,11 @@ const getPrintMediaQuery = () => {
14
14
  return matchMedia('print');
15
15
  };
16
16
  export function useIsPrintMedia() {
17
+ // eslint-disable-next-line @eslint-react/naming-convention/use-state
17
18
  const [printMediaQuery] = useState(getPrintMediaQuery);
18
- const [isPrint, changeIsPrint] = useState(!!printMediaQuery?.matches);
19
+ const [isPrint, setIsPrint] = useState(!!printMediaQuery?.matches);
19
20
  const onChange = useCallback((mqList) => {
20
- changeIsPrint(mqList.matches);
21
+ setIsPrint(mqList.matches);
21
22
  }, []);
22
23
  useEffect(() => {
23
24
  printMediaQuery?.addEventListener('change', onChange);
@@ -5,6 +5,7 @@ export const useMemoizedFn =
5
5
  (fn) => {
6
6
  /* eslint-enable @typescript-eslint/no-explicit-any */
7
7
  const fnRef = useRef(fn);
8
+ // eslint-disable-next-line react-hooks/refs
8
9
  fnRef.current = fn;
9
10
  return useCallback(
10
11
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
@@ -1,3 +1,3 @@
1
1
  import type { Language } from '../../shared/index.js';
2
2
  export declare const useLang: () => Language;
3
- export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "close" | "password" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip" | "customer_portal_global" | "customer_portal_china" | "user_login_region_china_tip" | "user_login_region_global_tip" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat") => string;
3
+ export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "password" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "close" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip" | "customer_portal_global" | "customer_portal_china" | "user_login_region_china_tip" | "user_login_region_global_tip" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat") => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "1.13.3",
3
+ "version": "1.14.1",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "homepage": "https://github.com/alauda/doom#readme",
12
12
  "license": "MIT",
13
13
  "engines": {
14
- "node": ">=18.17.0 <20 || >=20.1.0"
14
+ "node": ">=20.19.0"
15
15
  },
16
16
  "bin": "lib/cli/index.js",
17
17
  "exports": {
@@ -40,12 +40,11 @@
40
40
  "rspress-plugins"
41
41
  ],
42
42
  "dependencies": {
43
- "@alauda/doom-export": "^0.1.1",
44
- "@cspell/eslint-plugin": "^8.19.4 || ^9.2.1",
45
- "@eslint-react/eslint-plugin": "^1.53.1",
46
- "@inquirer/prompts": "^7.8.6",
43
+ "@alauda/doom-export": "^0.2.0",
44
+ "@cspell/eslint-plugin": "^9.2.1",
45
+ "@eslint-react/eslint-plugin": "^2.2.2",
46
+ "@inquirer/prompts": "^7.9.0",
47
47
  "@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
48
- "@playwright/browser-chromium": "^1.55.1",
49
48
  "@rsbuild/plugin-react": "^1.4.1",
50
49
  "@rsbuild/plugin-sass": "^1.4.0",
51
50
  "@rsbuild/plugin-svgr": "^1.2.2",
@@ -60,10 +59,10 @@
60
59
  "ab64": "^0.1.6",
61
60
  "chokidar": "^4.0.3",
62
61
  "clsx": "^2.1.1",
63
- "commander": "^13.1.0 || ^14.0.1",
62
+ "commander": "^14.0.1",
64
63
  "ejs": "^3.1.10",
65
- "es-toolkit": "^1.39.10",
66
- "eslint": "^9.36.0",
64
+ "es-toolkit": "^1.40.0",
65
+ "eslint": "^9.37.0",
67
66
  "eslint-plugin-mdx": "^3.6.2",
68
67
  "globals": "^16.4.0",
69
68
  "html-tag-names": "^2.1.0",
@@ -75,13 +74,13 @@
75
74
  "mdast-util-to-markdown": "^2.1.2",
76
75
  "mdast-util-to-string": "^4.0.0",
77
76
  "mermaid": "^11.12.0",
78
- "openai": "^5.23.1",
77
+ "openai": "^6.3.0",
79
78
  "openapi-types": "^12.1.3",
80
79
  "p-ratelimit": "^1.0.1",
81
80
  "picomatch": "^4.0.3",
82
81
  "pluralize": "^8.0.0",
83
82
  "react-markdown": "^10.1.0",
84
- "react-tooltip": "^5.29.1",
83
+ "react-tooltip": "^5.30.0",
85
84
  "rehype-raw": "^7.0.0",
86
85
  "rehype-sanitize": "^6.0.0",
87
86
  "remark-directive": "^4.0.0",
@@ -98,12 +97,12 @@
98
97
  "remark-stringify": "^11.0.0",
99
98
  "shiki": "^3.13.0",
100
99
  "simple-git": "^3.28.0",
101
- "string-width": "^7.2.0",
100
+ "string-width": "^8.1.0",
102
101
  "swagger2openapi": "^7.0.8",
103
102
  "tinyglobby": "^0.2.15",
104
- "type-fest": "^4.41.0 || ^5.0.0",
105
- "typescript": "^5.9.2",
106
- "typescript-eslint": "^8.44.1",
103
+ "type-fest": "^5.1.0",
104
+ "typescript": "^5.9.3",
105
+ "typescript-eslint": "^8.46.1",
107
106
  "unified": "^11.0.5",
108
107
  "unified-lint-rule": "^3.0.1",
109
108
  "unist-util-position": "^5.0.0",
@@ -1,6 +1,10 @@
1
1
  :global .overview-index.doom-overview-index {
2
2
  padding-left: 0;
3
3
  padding-right: 0;
4
+
5
+ h2:first-child:before {
6
+ display: none;
7
+ }
4
8
  }
5
9
 
6
10
  .overview-groups a {