@alauda/doom 1.14.0 → 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/translate.js
CHANGED
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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([
|
|
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
|
}
|