@alauda/doom 0.17.5 → 0.17.6
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.d.ts +1 -1
- package/lib/cli/translate.js +4 -2
- package/lib/types.d.ts +1 -0
- package/package.json +4 -4
package/lib/cli/translate.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface InternalTranslateOptions extends TranslateOptions {
|
|
|
16
16
|
targetContent?: string;
|
|
17
17
|
additionalPrompts?: string;
|
|
18
18
|
}
|
|
19
|
-
export declare const translate: ({ source, sourceContent, target, targetContent, systemPrompt, additionalPrompts, }: InternalTranslateOptions) => Promise<string>;
|
|
19
|
+
export declare const translate: ({ source, sourceContent, target, targetContent, systemPrompt, userPrompt, additionalPrompts, }: InternalTranslateOptions) => Promise<string>;
|
|
20
20
|
export interface TranslateCommandOptions {
|
|
21
21
|
source: string;
|
|
22
22
|
target: string;
|
package/lib/cli/translate.js
CHANGED
|
@@ -59,10 +59,12 @@ const DEFAULT_SYSTEM_PROMPT = `
|
|
|
59
59
|
|
|
60
60
|
最终只需要输出最后一步的结果,不需要输出之前步骤的结果。
|
|
61
61
|
|
|
62
|
+
<%= userPrompt %>
|
|
63
|
+
|
|
62
64
|
<%= additionalPrompts %>
|
|
63
65
|
`.trim();
|
|
64
66
|
let openai;
|
|
65
|
-
export const translate = async ({ source, sourceContent, target, targetContent = '', systemPrompt, additionalPrompts = '', }) => {
|
|
67
|
+
export const translate = async ({ source, sourceContent, target, targetContent = '', systemPrompt, userPrompt = '', additionalPrompts = '', }) => {
|
|
66
68
|
if (!openai) {
|
|
67
69
|
openai = new AzureOpenAI({
|
|
68
70
|
endpoint: process.env.AZURE_OPENAI_ENDPOINT ||
|
|
@@ -77,7 +79,7 @@ export const translate = async ({ source, sourceContent, target, targetContent =
|
|
|
77
79
|
messages: [
|
|
78
80
|
{
|
|
79
81
|
role: 'system',
|
|
80
|
-
content: await render(systemPrompt?.trim() || DEFAULT_SYSTEM_PROMPT, { sourceLang, targetLang, additionalPrompts }, { async: true }),
|
|
82
|
+
content: await render(systemPrompt?.trim() || DEFAULT_SYSTEM_PROMPT, { sourceLang, targetLang, userPrompt, additionalPrompts }, { async: true }),
|
|
81
83
|
},
|
|
82
84
|
{
|
|
83
85
|
role: 'user',
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"@swc/core": "1.11.16",
|
|
81
81
|
"@types/cli-progress": "^3.11.6",
|
|
82
82
|
"@types/ejs": "^3.1.5",
|
|
83
|
-
"@types/node": "^18.19.
|
|
84
|
-
"@types/picomatch": "^
|
|
83
|
+
"@types/node": "^18.19.86",
|
|
84
|
+
"@types/picomatch": "^4.0.0",
|
|
85
85
|
"@types/react": "^18.3.20",
|
|
86
|
-
"@types/react-dom": "^18.3.
|
|
86
|
+
"@types/react-dom": "^18.3.6",
|
|
87
87
|
"@types/swagger2openapi": "^7.0.4",
|
|
88
88
|
"@unts/patch-package": "^8.1.1",
|
|
89
89
|
"eslint": "^9.23.0",
|