strapi-llm-translator 0.9.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/_chunks/App-Boy_i56G.mjs +223 -0
  4. package/dist/_chunks/App-COSMdnpL.js +223 -0
  5. package/dist/_chunks/de-CvAR4QXO.js +29 -0
  6. package/dist/_chunks/de-D3VSS3Mq.mjs +29 -0
  7. package/dist/_chunks/en-BjVvIBv8.js +29 -0
  8. package/dist/_chunks/en-BnBUQVgF.mjs +29 -0
  9. package/dist/_chunks/index-BEhzLY5B.mjs +277 -0
  10. package/dist/_chunks/index-DuLkx3CK.js +276 -0
  11. package/dist/admin/index.js +3 -0
  12. package/dist/admin/index.mjs +4 -0
  13. package/dist/admin/src/components/Initializer.d.ts +5 -0
  14. package/dist/admin/src/components/LLMButton.d.ts +2 -0
  15. package/dist/admin/src/components/PluginIcon.d.ts +18 -0
  16. package/dist/admin/src/index.d.ts +11 -0
  17. package/dist/admin/src/pages/App.d.ts +2 -0
  18. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  19. package/dist/admin/src/pluginId.d.ts +1 -0
  20. package/dist/admin/src/utils/constants.d.ts +4 -0
  21. package/dist/admin/src/utils/getLocaleFromUrl.d.ts +1 -0
  22. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  23. package/dist/server/index.js +392 -0
  24. package/dist/server/index.mjs +393 -0
  25. package/dist/server/src/bootstrap.d.ts +5 -0
  26. package/dist/server/src/config/constants.d.ts +2 -0
  27. package/dist/server/src/config/index.d.ts +9 -0
  28. package/dist/server/src/content-types/index.d.ts +2 -0
  29. package/dist/server/src/controllers/admin.controller.d.ts +11 -0
  30. package/dist/server/src/controllers/index.d.ts +23 -0
  31. package/dist/server/src/destroy.d.ts +5 -0
  32. package/dist/server/src/index.d.ts +63 -0
  33. package/dist/server/src/middlewares/index.d.ts +2 -0
  34. package/dist/server/src/policies/index.d.ts +2 -0
  35. package/dist/server/src/register.d.ts +5 -0
  36. package/dist/server/src/routes/admin.d.ts +9 -0
  37. package/dist/server/src/routes/index.d.ts +14 -0
  38. package/dist/server/src/services/index.d.ts +6 -0
  39. package/dist/server/src/services/llm-service.d.ts +6 -0
  40. package/dist/server/src/types/controllers.d.ts +22 -0
  41. package/dist/server/src/types/index.d.ts +41 -0
  42. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Franziska Fieke (grenzbotin)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # <img alt="Strapi LLM Translator Icon" src="./docs/strapi-llm-translator-icon.png" width="50"> Strapi LLM Translator
2
+
3
+ #### AI-Powered Content Translation for Strapi
4
+
5
+ The Strapi LLM Translator plugin enhances your localization workflow by utilising LLMs to translate your content fields with a single click. Compatible with any OpenAI-compatible LLM, it preserves your original formatting while delivering fast, accurate results in seconds.
6
+
7
+ ## 🚀 Key Features
8
+
9
+ - 🌍 **Multi-field Support** - Translates all text-based fields (string, text, richtext)
10
+ - 🔌 **LLM Agnostic** - Works with any OpenAI-compatible API (your choice of provider)
11
+ - 📝 **Format Preservation** - Maintains markdown formatting during translation
12
+ - 🔗 **Smart UUID Handling** - Auto-translates slugs when i18n is enabled with relative fields
13
+ - ⚡ **Auto-fill** - Instantly populates generated translations
14
+ - 🎛️ **Customizable** - Adjust system prompts and temperature for optimal results
15
+
16
+ ---
17
+
18
+ <img alt="strapi-llm-translator" style="border-radius:5px" src="./docs/strapi-llm-translator.gif" width="640">
19
+
20
+ ---
21
+
22
+ ## ✅ Tested With
23
+
24
+ - **Strapi**: v5.12.4
25
+ - **LLM Providers**:
26
+ - OpenAI: `gpt-4o`
27
+ - Groq: `meta-llama/llama-4-scout-17b-16e-instruct`
28
+
29
+ ## 🛠️ Installation & Setup
30
+
31
+ ### Prerequisites
32
+
33
+ - Strapi project (v5+)
34
+ - API key for your preferred LLM provider, opt. BaseUrl + model name
35
+
36
+ ### Installation
37
+
38
+ 1. Install the plugin in your Strapi project:
39
+
40
+ ```bash
41
+ npm install tbd
42
+ ```
43
+
44
+ 2. Configure environment variables:
45
+
46
+ ```
47
+ # Required - Your LLM provider API key
48
+ LLM_TRANSLATOR_LLM_API_KEY=
49
+
50
+ # Optional - Defaults to OpenAI's endpoint
51
+ STRAPI_ADMIN_LLM_TRANSLATOR_LLM_BASE_URL=
52
+
53
+ # Optional - Defaults to gpt-4o
54
+ STRAPI_ADMIN_LLM_TRANSLATOR_LLM_MODEL=
55
+ ```
56
+
57
+ 3. Rebuild your admin panel:
58
+
59
+ ```
60
+ npm run build
61
+ ```
62
+
63
+ After installation, customize the translation behavior through the LLM Translator configuration page:
64
+
65
+ ---
66
+
67
+ <img alt="Strapi LLM Translator Configuration screen" style="border-radius:5px" src="./docs/strapi-llm-translator-configuration.png" width="640">
68
+
69
+ ---
70
+
71
+ ## 💻 Plugin Development
72
+
73
+ To contribute to the plugin development:
74
+
75
+ 1. Navigate to your Strapi project
76
+ 2. Add and link the plugin: `npx yalc add strapi-llm-translator && npx yalc link strapi-llm-translator && npm install`
77
+ 3. Start your Strapi project
78
+ 4. In a separate terminal, watch the plugin for changes:
79
+ `npm run watch:link`
80
+
81
+ ## About
82
+
83
+ Franziska Fieke ([grenzbotin](https://github.com/grenzbotin)) – [vulpis.dev](https://vulpis.dev)
84
+
85
+ Distributed under the MIT license.
86
+ See `LICENSE` for more information.
@@ -0,0 +1,223 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useFetchClient, Page } from "@strapi/strapi/admin";
3
+ import { Routes, Route } from "react-router-dom";
4
+ import { Main, Box, Flex, Typography, Field, Textarea, NumberInput, TextInput, Button } from "@strapi/design-system";
5
+ import { useIntl } from "react-intl";
6
+ import { useState, useEffect } from "react";
7
+ import { P as PluginIcon, g as getTranslation, a as PLUGIN_ID } from "./index-BEhzLY5B.mjs";
8
+ const DEFAULT_SYSTEM_PROMPT = "You are a professional translator. Your task is to translate the provided content accurately while preserving the original meaning and tone.";
9
+ const DEFAULT_LLM_TEMPERATURE = 0.3;
10
+ const MAX_LLM_TEMPERATURE = 2;
11
+ const MIN_LLM_TEMPERATURE = 0.1;
12
+ const HomePage = () => {
13
+ const [config, setConfig] = useState({ systemPrompt: "", temperature: 0.3 });
14
+ const { formatMessage } = useIntl();
15
+ const { get, post } = useFetchClient();
16
+ useEffect(() => {
17
+ const fetchData = async () => {
18
+ const response = await get(`/${PLUGIN_ID}/config`);
19
+ setConfig({ ...config, ...response.data });
20
+ };
21
+ fetchData();
22
+ }, []);
23
+ const handleSubmit = async (e) => {
24
+ e.preventDefault();
25
+ await post(`/${PLUGIN_ID}/config`, { ...config });
26
+ };
27
+ const handleRestore = async () => {
28
+ setConfig({ systemPrompt: DEFAULT_SYSTEM_PROMPT, temperature: DEFAULT_LLM_TEMPERATURE });
29
+ await post(`/${PLUGIN_ID}/config`, {
30
+ systemPrompt: DEFAULT_SYSTEM_PROMPT,
31
+ temperature: DEFAULT_LLM_TEMPERATURE
32
+ });
33
+ };
34
+ return /* @__PURE__ */ jsxs(Main, { children: [
35
+ /* @__PURE__ */ jsxs(
36
+ Box,
37
+ {
38
+ paddingLeft: 10,
39
+ paddingRight: 10,
40
+ paddingBottom: 8,
41
+ paddingTop: 8,
42
+ "data-strapi-header": true,
43
+ background: "neutral100",
44
+ children: [
45
+ /* @__PURE__ */ jsxs(Flex, { "data-strapi-header": true, alignItems: "center", gap: 3, marginBottom: 4, children: [
46
+ /* @__PURE__ */ jsx(PluginIcon, { width: 42, height: 42 }),
47
+ " ",
48
+ /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", fontWeight: "bold", children: formatMessage({
49
+ id: getTranslation("plugin.page.title"),
50
+ defaultMessage: "LLM Translator (Configuration)"
51
+ }) })
52
+ ] }),
53
+ /* @__PURE__ */ jsx(Typography, { variant: "delta", textColor: "neutral600", fontWeight: "normal", children: formatMessage({
54
+ id: getTranslation("plugin.page.description"),
55
+ defaultMessage: "Configure the LLM Translator plugin settings. Be aware that Base Model, API Key and LLM Base URL need to be set as environment variables."
56
+ }) })
57
+ ]
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(Box, { paddingLeft: 10, paddingRight: 10, children: /* @__PURE__ */ jsx(
61
+ Box,
62
+ {
63
+ paddingLeft: 10,
64
+ paddingRight: 10,
65
+ paddingTop: 8,
66
+ paddingBottom: 8,
67
+ background: "neutral0",
68
+ children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, children: [
69
+ /* @__PURE__ */ jsxs(
70
+ Field.Root,
71
+ {
72
+ id: "system_prompt",
73
+ hint: formatMessage({
74
+ id: getTranslation("plugin.page.form.system_prompt_hint"),
75
+ defaultMessage: "This is (part) of the prompt that will be used to instruct the LLM. It should be clear and concise."
76
+ }),
77
+ required: true,
78
+ children: [
79
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
80
+ id: getTranslation("plugin.page.form.system_prompt"),
81
+ defaultMessage: "System prompt"
82
+ }) }),
83
+ /* @__PURE__ */ jsx(
84
+ Textarea,
85
+ {
86
+ id: "system_prompt",
87
+ value: config.systemPrompt,
88
+ onChange: (e) => setConfig({ ...config, systemPrompt: e.target.value }),
89
+ required: true,
90
+ placeholder: DEFAULT_SYSTEM_PROMPT,
91
+ name: "system_prompt"
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx(Field.Error, {}),
95
+ /* @__PURE__ */ jsx(Field.Hint, {})
96
+ ]
97
+ }
98
+ ),
99
+ /* @__PURE__ */ jsxs(Flex, { gap: 4, marginTop: 6, flex: 1, children: [
100
+ /* @__PURE__ */ jsxs(
101
+ Field.Root,
102
+ {
103
+ id: "llm_temperature",
104
+ hint: formatMessage({
105
+ id: getTranslation("plugin.page.form.llm_temperature_hint"),
106
+ defaultMessage: "Temperature setting for the LLM. A higher value will make the output more random, while a lower value will make it more focused and deterministic."
107
+ }),
108
+ flex: 1,
109
+ children: [
110
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
111
+ id: getTranslation("plugin.page.form.llm_temperature"),
112
+ defaultMessage: "LLM Temperature"
113
+ }) }),
114
+ /* @__PURE__ */ jsx(
115
+ NumberInput,
116
+ {
117
+ id: "llm_temperature",
118
+ value: config.temperature,
119
+ name: "llm_temperature",
120
+ step: 0.1,
121
+ min: MIN_LLM_TEMPERATURE,
122
+ max: MAX_LLM_TEMPERATURE,
123
+ onValueChange: (value) => {
124
+ let tempValue = DEFAULT_LLM_TEMPERATURE;
125
+ if (value === void 0) {
126
+ tempValue = DEFAULT_LLM_TEMPERATURE;
127
+ } else if (value < MIN_LLM_TEMPERATURE) {
128
+ tempValue = MIN_LLM_TEMPERATURE;
129
+ } else if (value > MAX_LLM_TEMPERATURE) {
130
+ tempValue = MAX_LLM_TEMPERATURE;
131
+ } else {
132
+ tempValue = value;
133
+ }
134
+ setConfig({ ...config, temperature: tempValue });
135
+ }
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx(Field.Error, {}),
139
+ /* @__PURE__ */ jsx(Field.Hint, {})
140
+ ]
141
+ }
142
+ ),
143
+ /* @__PURE__ */ jsxs(
144
+ Field.Root,
145
+ {
146
+ id: "llm_model",
147
+ flex: 1,
148
+ hint: formatMessage({
149
+ id: getTranslation("plugin.page.form.llm_model_hint"),
150
+ defaultMessage: "Model that will be used to generate the translations. It should be set as an environment variable."
151
+ }),
152
+ children: [
153
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
154
+ id: getTranslation("plugin.page.form.llm_model"),
155
+ defaultMessage: "LLM Model"
156
+ }) }),
157
+ /* @__PURE__ */ jsx(
158
+ TextInput,
159
+ {
160
+ id: "llm_model",
161
+ value: process.env.STRAPI_ADMIN_LLM_TRANSLATOR_LLM_MODEL,
162
+ disabled: true,
163
+ name: "llm_model"
164
+ }
165
+ ),
166
+ /* @__PURE__ */ jsx(Field.Error, {}),
167
+ /* @__PURE__ */ jsx(Field.Hint, {})
168
+ ]
169
+ }
170
+ ),
171
+ /* @__PURE__ */ jsxs(
172
+ Field.Root,
173
+ {
174
+ id: "llm_base_url",
175
+ flex: 1,
176
+ hint: formatMessage({
177
+ id: getTranslation("plugin.page.form.llm_base_url_hint"),
178
+ defaultMessage: "Base URL for the LLM API. It needs to be set as an environment variable."
179
+ }),
180
+ children: [
181
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
182
+ id: getTranslation("plugin.page.form.llm_base_url"),
183
+ defaultMessage: "LLM Base Url"
184
+ }) }),
185
+ /* @__PURE__ */ jsx(
186
+ TextInput,
187
+ {
188
+ id: "llm_base_url",
189
+ value: process.env.STRAPI_ADMIN_LLM_TRANSLATOR_LLM_BASE_URL,
190
+ disabled: true,
191
+ name: "llm_base_url"
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsx(Field.Error, {}),
195
+ /* @__PURE__ */ jsx(Field.Hint, {})
196
+ ]
197
+ }
198
+ )
199
+ ] }),
200
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, marginTop: 6, justifyContent: "flex-end", children: [
201
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", type: "button", onClick: handleRestore, marginTop: 4, children: formatMessage({
202
+ id: getTranslation("plugin.page.form.restore"),
203
+ defaultMessage: "Restore to default"
204
+ }) }),
205
+ /* @__PURE__ */ jsx(Button, { variant: "default", type: "submit", marginTop: 4, children: formatMessage({
206
+ id: getTranslation("plugin.page.form.save"),
207
+ defaultMessage: "Save"
208
+ }) })
209
+ ] })
210
+ ] })
211
+ }
212
+ ) })
213
+ ] });
214
+ };
215
+ const App = () => {
216
+ return /* @__PURE__ */ jsxs(Routes, { children: [
217
+ /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
218
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
219
+ ] });
220
+ };
221
+ export {
222
+ App
223
+ };
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const admin = require("@strapi/strapi/admin");
5
+ const reactRouterDom = require("react-router-dom");
6
+ const designSystem = require("@strapi/design-system");
7
+ const reactIntl = require("react-intl");
8
+ const react = require("react");
9
+ const index = require("./index-DuLkx3CK.js");
10
+ const DEFAULT_SYSTEM_PROMPT = "You are a professional translator. Your task is to translate the provided content accurately while preserving the original meaning and tone.";
11
+ const DEFAULT_LLM_TEMPERATURE = 0.3;
12
+ const MAX_LLM_TEMPERATURE = 2;
13
+ const MIN_LLM_TEMPERATURE = 0.1;
14
+ const HomePage = () => {
15
+ const [config, setConfig] = react.useState({ systemPrompt: "", temperature: 0.3 });
16
+ const { formatMessage } = reactIntl.useIntl();
17
+ const { get, post } = admin.useFetchClient();
18
+ react.useEffect(() => {
19
+ const fetchData = async () => {
20
+ const response = await get(`/${index.PLUGIN_ID}/config`);
21
+ setConfig({ ...config, ...response.data });
22
+ };
23
+ fetchData();
24
+ }, []);
25
+ const handleSubmit = async (e) => {
26
+ e.preventDefault();
27
+ await post(`/${index.PLUGIN_ID}/config`, { ...config });
28
+ };
29
+ const handleRestore = async () => {
30
+ setConfig({ systemPrompt: DEFAULT_SYSTEM_PROMPT, temperature: DEFAULT_LLM_TEMPERATURE });
31
+ await post(`/${index.PLUGIN_ID}/config`, {
32
+ systemPrompt: DEFAULT_SYSTEM_PROMPT,
33
+ temperature: DEFAULT_LLM_TEMPERATURE
34
+ });
35
+ };
36
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
37
+ /* @__PURE__ */ jsxRuntime.jsxs(
38
+ designSystem.Box,
39
+ {
40
+ paddingLeft: 10,
41
+ paddingRight: 10,
42
+ paddingBottom: 8,
43
+ paddingTop: 8,
44
+ "data-strapi-header": true,
45
+ background: "neutral100",
46
+ children: [
47
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { "data-strapi-header": true, alignItems: "center", gap: 3, marginBottom: 4, children: [
48
+ /* @__PURE__ */ jsxRuntime.jsx(index.PluginIcon, { width: 42, height: 42 }),
49
+ " ",
50
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", fontWeight: "bold", children: formatMessage({
51
+ id: index.getTranslation("plugin.page.title"),
52
+ defaultMessage: "LLM Translator (Configuration)"
53
+ }) })
54
+ ] }),
55
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", textColor: "neutral600", fontWeight: "normal", children: formatMessage({
56
+ id: index.getTranslation("plugin.page.description"),
57
+ defaultMessage: "Configure the LLM Translator plugin settings. Be aware that Base Model, API Key and LLM Base URL need to be set as environment variables."
58
+ }) })
59
+ ]
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 10, paddingRight: 10, children: /* @__PURE__ */ jsxRuntime.jsx(
63
+ designSystem.Box,
64
+ {
65
+ paddingLeft: 10,
66
+ paddingRight: 10,
67
+ paddingTop: 8,
68
+ paddingBottom: 8,
69
+ background: "neutral0",
70
+ children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, children: [
71
+ /* @__PURE__ */ jsxRuntime.jsxs(
72
+ designSystem.Field.Root,
73
+ {
74
+ id: "system_prompt",
75
+ hint: formatMessage({
76
+ id: index.getTranslation("plugin.page.form.system_prompt_hint"),
77
+ defaultMessage: "This is (part) of the prompt that will be used to instruct the LLM. It should be clear and concise."
78
+ }),
79
+ required: true,
80
+ children: [
81
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
82
+ id: index.getTranslation("plugin.page.form.system_prompt"),
83
+ defaultMessage: "System prompt"
84
+ }) }),
85
+ /* @__PURE__ */ jsxRuntime.jsx(
86
+ designSystem.Textarea,
87
+ {
88
+ id: "system_prompt",
89
+ value: config.systemPrompt,
90
+ onChange: (e) => setConfig({ ...config, systemPrompt: e.target.value }),
91
+ required: true,
92
+ placeholder: DEFAULT_SYSTEM_PROMPT,
93
+ name: "system_prompt"
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
97
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
98
+ ]
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, marginTop: 6, flex: 1, children: [
102
+ /* @__PURE__ */ jsxRuntime.jsxs(
103
+ designSystem.Field.Root,
104
+ {
105
+ id: "llm_temperature",
106
+ hint: formatMessage({
107
+ id: index.getTranslation("plugin.page.form.llm_temperature_hint"),
108
+ defaultMessage: "Temperature setting for the LLM. A higher value will make the output more random, while a lower value will make it more focused and deterministic."
109
+ }),
110
+ flex: 1,
111
+ children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
113
+ id: index.getTranslation("plugin.page.form.llm_temperature"),
114
+ defaultMessage: "LLM Temperature"
115
+ }) }),
116
+ /* @__PURE__ */ jsxRuntime.jsx(
117
+ designSystem.NumberInput,
118
+ {
119
+ id: "llm_temperature",
120
+ value: config.temperature,
121
+ name: "llm_temperature",
122
+ step: 0.1,
123
+ min: MIN_LLM_TEMPERATURE,
124
+ max: MAX_LLM_TEMPERATURE,
125
+ onValueChange: (value) => {
126
+ let tempValue = DEFAULT_LLM_TEMPERATURE;
127
+ if (value === void 0) {
128
+ tempValue = DEFAULT_LLM_TEMPERATURE;
129
+ } else if (value < MIN_LLM_TEMPERATURE) {
130
+ tempValue = MIN_LLM_TEMPERATURE;
131
+ } else if (value > MAX_LLM_TEMPERATURE) {
132
+ tempValue = MAX_LLM_TEMPERATURE;
133
+ } else {
134
+ tempValue = value;
135
+ }
136
+ setConfig({ ...config, temperature: tempValue });
137
+ }
138
+ }
139
+ ),
140
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
141
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
142
+ ]
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsxRuntime.jsxs(
146
+ designSystem.Field.Root,
147
+ {
148
+ id: "llm_model",
149
+ flex: 1,
150
+ hint: formatMessage({
151
+ id: index.getTranslation("plugin.page.form.llm_model_hint"),
152
+ defaultMessage: "Model that will be used to generate the translations. It should be set as an environment variable."
153
+ }),
154
+ children: [
155
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
156
+ id: index.getTranslation("plugin.page.form.llm_model"),
157
+ defaultMessage: "LLM Model"
158
+ }) }),
159
+ /* @__PURE__ */ jsxRuntime.jsx(
160
+ designSystem.TextInput,
161
+ {
162
+ id: "llm_model",
163
+ value: process.env.STRAPI_ADMIN_LLM_TRANSLATOR_LLM_MODEL,
164
+ disabled: true,
165
+ name: "llm_model"
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
169
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
170
+ ]
171
+ }
172
+ ),
173
+ /* @__PURE__ */ jsxRuntime.jsxs(
174
+ designSystem.Field.Root,
175
+ {
176
+ id: "llm_base_url",
177
+ flex: 1,
178
+ hint: formatMessage({
179
+ id: index.getTranslation("plugin.page.form.llm_base_url_hint"),
180
+ defaultMessage: "Base URL for the LLM API. It needs to be set as an environment variable."
181
+ }),
182
+ children: [
183
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
184
+ id: index.getTranslation("plugin.page.form.llm_base_url"),
185
+ defaultMessage: "LLM Base Url"
186
+ }) }),
187
+ /* @__PURE__ */ jsxRuntime.jsx(
188
+ designSystem.TextInput,
189
+ {
190
+ id: "llm_base_url",
191
+ value: process.env.STRAPI_ADMIN_LLM_TRANSLATOR_LLM_BASE_URL,
192
+ disabled: true,
193
+ name: "llm_base_url"
194
+ }
195
+ ),
196
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
197
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
198
+ ]
199
+ }
200
+ )
201
+ ] }),
202
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, marginTop: 6, justifyContent: "flex-end", children: [
203
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", type: "button", onClick: handleRestore, marginTop: 4, children: formatMessage({
204
+ id: index.getTranslation("plugin.page.form.restore"),
205
+ defaultMessage: "Restore to default"
206
+ }) }),
207
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "default", type: "submit", marginTop: 4, children: formatMessage({
208
+ id: index.getTranslation("plugin.page.form.save"),
209
+ defaultMessage: "Save"
210
+ }) })
211
+ ] })
212
+ ] })
213
+ }
214
+ ) })
215
+ ] });
216
+ };
217
+ const App = () => {
218
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
219
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
220
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
221
+ ] });
222
+ };
223
+ exports.App = App;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const de = {
4
+ "strapi-llm-translator.button.label.error": "Übersetzung fehlgeschlagen",
5
+ "strapi-llm-translator.button.label.idle": "Mit KI übersetzen",
6
+ "strapi-llm-translator.button.label.loading": "Inhalt wird übersetzt...",
7
+ "strapi-llm-translator.button.label.success": "Übersetzung abgeschlossen",
8
+ "strapi-llm-translator.button.tooltip.disabled": "Übersetzung ist nur für lokalisierte Inhaltstypen verfügbar",
9
+ "strapi-llm-translator.button.tooltip.error": "Übersetzung fehlgeschlagen. Klicken Sie zum erneuten Versuch",
10
+ "strapi-llm-translator.button.tooltip.idle": "Inhalt mit KI übersetzen",
11
+ "strapi-llm-translator.button.tooltip.loading": "Inhalt wird übersetzt",
12
+ "strapi-llm-translator.button.tooltip.success": "Inhalt wurde erfolgreich übersetzt",
13
+ "strapi-llm-translator.notification.error": "Übersetzung fehlgeschlagen. Fehler:",
14
+ "strapi-llm-translator.notification.success": "Übersetzung erfolgreich.",
15
+ "strapi-llm-translator.plugin.name": "LLM Translator",
16
+ "strapi-llm-translator.plugin.page.description": "Konfigurieren Sie die Einstellungen des LLM Translator Plugins. Beachten Sie, dass Base Model, API Key und LLM Base URL als Umgebungsvariablen gesetzt werden müssen.",
17
+ "strapi-llm-translator.plugin.page.form.llm_base_url": "LLM Basis-URL",
18
+ "strapi-llm-translator.plugin.page.form.llm_base_url_hint": "Basis-URL für die LLM API. Sie muss als Umgebungsvariable gesetzt werden.",
19
+ "strapi-llm-translator.plugin.page.form.llm_model": "LLM Modell",
20
+ "strapi-llm-translator.plugin.page.form.llm_model_hint": "LLM-Modell, das für die Übersetzungen verwendet wird. Es muss als Umgebungsvariable gesetzt werden.",
21
+ "strapi-llm-translator.plugin.page.form.llm_temperature": "LLM Temperatur",
22
+ "strapi-llm-translator.plugin.page.form.llm_temperature_hint": "Ein höherer Wert macht die Ausgabe zufälliger, während ein niedrigerer Wert sie fokussierter und deterministischer macht.",
23
+ "strapi-llm-translator.plugin.page.form.restore": "Auf Standard zurücksetzen",
24
+ "strapi-llm-translator.plugin.page.form.save": "Änderungen speichern",
25
+ "strapi-llm-translator.plugin.page.form.system_prompt": "System Prompt",
26
+ "strapi-llm-translator.plugin.page.form.system_prompt_hint": "Dies ist (ein Teil) des Prompts, der verwendet wird, um das LLM anzuweisen. Er sollte klar und präzise sein.",
27
+ "strapi-llm-translator.plugin.page.title": "LLM Translator (Übersetzungskonfiguration)"
28
+ };
29
+ exports.default = de;
@@ -0,0 +1,29 @@
1
+ const de = {
2
+ "strapi-llm-translator.button.label.error": "Übersetzung fehlgeschlagen",
3
+ "strapi-llm-translator.button.label.idle": "Mit KI übersetzen",
4
+ "strapi-llm-translator.button.label.loading": "Inhalt wird übersetzt...",
5
+ "strapi-llm-translator.button.label.success": "Übersetzung abgeschlossen",
6
+ "strapi-llm-translator.button.tooltip.disabled": "Übersetzung ist nur für lokalisierte Inhaltstypen verfügbar",
7
+ "strapi-llm-translator.button.tooltip.error": "Übersetzung fehlgeschlagen. Klicken Sie zum erneuten Versuch",
8
+ "strapi-llm-translator.button.tooltip.idle": "Inhalt mit KI übersetzen",
9
+ "strapi-llm-translator.button.tooltip.loading": "Inhalt wird übersetzt",
10
+ "strapi-llm-translator.button.tooltip.success": "Inhalt wurde erfolgreich übersetzt",
11
+ "strapi-llm-translator.notification.error": "Übersetzung fehlgeschlagen. Fehler:",
12
+ "strapi-llm-translator.notification.success": "Übersetzung erfolgreich.",
13
+ "strapi-llm-translator.plugin.name": "LLM Translator",
14
+ "strapi-llm-translator.plugin.page.description": "Konfigurieren Sie die Einstellungen des LLM Translator Plugins. Beachten Sie, dass Base Model, API Key und LLM Base URL als Umgebungsvariablen gesetzt werden müssen.",
15
+ "strapi-llm-translator.plugin.page.form.llm_base_url": "LLM Basis-URL",
16
+ "strapi-llm-translator.plugin.page.form.llm_base_url_hint": "Basis-URL für die LLM API. Sie muss als Umgebungsvariable gesetzt werden.",
17
+ "strapi-llm-translator.plugin.page.form.llm_model": "LLM Modell",
18
+ "strapi-llm-translator.plugin.page.form.llm_model_hint": "LLM-Modell, das für die Übersetzungen verwendet wird. Es muss als Umgebungsvariable gesetzt werden.",
19
+ "strapi-llm-translator.plugin.page.form.llm_temperature": "LLM Temperatur",
20
+ "strapi-llm-translator.plugin.page.form.llm_temperature_hint": "Ein höherer Wert macht die Ausgabe zufälliger, während ein niedrigerer Wert sie fokussierter und deterministischer macht.",
21
+ "strapi-llm-translator.plugin.page.form.restore": "Auf Standard zurücksetzen",
22
+ "strapi-llm-translator.plugin.page.form.save": "Änderungen speichern",
23
+ "strapi-llm-translator.plugin.page.form.system_prompt": "System Prompt",
24
+ "strapi-llm-translator.plugin.page.form.system_prompt_hint": "Dies ist (ein Teil) des Prompts, der verwendet wird, um das LLM anzuweisen. Er sollte klar und präzise sein.",
25
+ "strapi-llm-translator.plugin.page.title": "LLM Translator (Übersetzungskonfiguration)"
26
+ };
27
+ export {
28
+ de as default
29
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const en = {
4
+ "strapi-llm-translator.button.label.error": "Translation failed",
5
+ "strapi-llm-translator.button.label.idle": "Translate with AI",
6
+ "strapi-llm-translator.button.label.loading": "Translating content...",
7
+ "strapi-llm-translator.button.label.success": "Translation completed",
8
+ "strapi-llm-translator.button.tooltip.disabled": "Translation is only available for localized content types",
9
+ "strapi-llm-translator.button.tooltip.error": "Translation failed. Click to try again",
10
+ "strapi-llm-translator.button.tooltip.idle": "Translate content using AI",
11
+ "strapi-llm-translator.button.tooltip.loading": "Content is being translated",
12
+ "strapi-llm-translator.button.tooltip.success": "Content has been translated successfully",
13
+ "strapi-llm-translator.notification.error": "Translation failed. Error:",
14
+ "strapi-llm-translator.notification.success": "Translation completed successfully.",
15
+ "strapi-llm-translator.plugin.name": "LLM Translator",
16
+ "strapi-llm-translator.plugin.page.description": "Configure the LLM Translator plugin settings. Be aware that Base Model, API Key and LLM Base URL need to be set as environment variables.",
17
+ "strapi-llm-translator.plugin.page.form.llm_base_url": "LLM Base URL",
18
+ "strapi-llm-translator.plugin.page.form.llm_base_url_hint": "Base URL for the LLM API. It needs to be set as an environment variable.",
19
+ "strapi-llm-translator.plugin.page.form.llm_model": "LLM Model",
20
+ "strapi-llm-translator.plugin.page.form.llm_model_hint": "Model that will be used to generate the translations. It needs to be set as an environment variable.",
21
+ "strapi-llm-translator.plugin.page.form.llm_temperature": "LLM Temperature",
22
+ "strapi-llm-translator.plugin.page.form.llm_temperature_hint": "A higher value will make the output more random, while a lower value will make it more focused and deterministic.",
23
+ "strapi-llm-translator.plugin.page.form.restore": "Restore to default",
24
+ "strapi-llm-translator.plugin.page.form.save": "Save changes",
25
+ "strapi-llm-translator.plugin.page.form.system_prompt": "System Prompt",
26
+ "strapi-llm-translator.plugin.page.form.system_prompt_hint": "This is (part) of the prompt that will be used to instruct the LLM. It should be clear and concise.",
27
+ "strapi-llm-translator.plugin.page.title": "LLM Translator (Configuration)"
28
+ };
29
+ exports.default = en;