@alauda/doom 2.0.0 → 2.1.0

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.
@@ -8,7 +8,7 @@ import { removeLeadingSlash } from '@rspress/shared';
8
8
  import { Command } from 'commander';
9
9
  import ejs from 'ejs';
10
10
  import matter from 'gray-matter';
11
- import { AzureOpenAI, RateLimitError } from 'openai';
11
+ import { OpenAI, RateLimitError } from 'openai';
12
12
  import { pRateLimit } from 'p-ratelimit';
13
13
  import { glob } from 'tinyglobby';
14
14
  import { cyan, red } from 'yoctocolors';
@@ -83,7 +83,7 @@ The text for translation is provided below, within triple quotes:
83
83
  <% } %>
84
84
  `.trim();
85
85
  let openai;
86
- const openaiModel = process.env.AZURE_OPENAI_MODEL || 'gpt-4.1-mini';
86
+ const openaiModel = process.env.ALAUDA_OPENAI_MODEL || 'gpt-5.4-mini';
87
87
  const resolveTerms = async (sourceLang, targetLang, sourceContent) => {
88
88
  const parsedTerms = await parseTerms();
89
89
  // Filter terms that exist in source content and have translations for both source and target languages
@@ -202,11 +202,9 @@ export const translateWithChunks = async (options) => {
202
202
  };
203
203
  export const translate = async ({ source, sourceContent, target, systemPrompt, userPrompt = '', additionalPrompts = '', isChunk = false, }) => {
204
204
  if (!openai) {
205
- openai = new AzureOpenAI({
206
- endpoint: process.env.AZURE_OPENAI_ENDPOINT ||
207
- 'https://azure-ai-api-gateway.alauda.cn',
208
- apiKey: process.env.AZURE_OPENAI_API_KEY,
209
- apiVersion: process.env.OPENAI_API_VERSION || '2025-04-01-preview',
205
+ openai = new OpenAI({
206
+ baseURL: process.env.ALAUDA_OPENAI_BASE_URL,
207
+ apiKey: process.env.ALAUDA_OPENAI_API_KEY,
210
208
  });
211
209
  }
212
210
  const sourceLang = Language[source];
@@ -267,7 +265,7 @@ export const translateCommand = new Command('translate')
267
265
  .option('-s, --source <language>', `Document source language, one of ${supportedLanguages}`, 'en')
268
266
  .option('-t, --target <language>', `Document target language, one of ${supportedLanguages}`, 'zh')
269
267
  .requiredOption('-g, --glob <path...>', 'Glob patterns of source dirs/files to translate')
270
- .option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', parseBoolean, false)
268
+ .option('-C, --copy [boolean]', 'Whether to copy relative assets to the target directory instead of following links', parseBoolean, false)
271
269
  .action(async function (root) {
272
270
  const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
273
271
  if (!Object.hasOwn(Language, source) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {