Skip to content

Commit 7811a3b

Browse files
authored
Merge pull request #7883 from sagemathinc/sagews-soft-deprecation
SageWS soft deprecation
2 parents ac1522e + 6943763 commit 7811a3b

28 files changed

+585
-167
lines changed

src/packages/frontend/codemirror/extensions/ai-formula.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Button, Descriptions, Divider, Input, Modal, Space } from "antd";
22
import { debounce } from "lodash";
3+
import { useIntl } from "react-intl";
34

45
import { useLanguageModelSetting } from "@cocalc/frontend/account/useLanguageModelSetting";
56
import {
@@ -22,13 +23,14 @@ import {
2223
import AIAvatar from "@cocalc/frontend/components/ai-avatar";
2324
import { LLMModelName } from "@cocalc/frontend/components/llm-name";
2425
import LLMSelector from "@cocalc/frontend/frame-editors/llm/llm-selector";
26+
import { dialogs } from "@cocalc/frontend/i18n";
2527
import { show_react_modal } from "@cocalc/frontend/misc";
2628
import { LLMCostEstimation } from "@cocalc/frontend/misc/llm-cost-estimation";
2729
import track from "@cocalc/frontend/user-tracking";
2830
import { webapp_client } from "@cocalc/frontend/webapp-client";
2931
import { isFreeModel } from "@cocalc/util/db-schema/llm-utils";
30-
import { unreachable } from "@cocalc/util/misc";
3132
import { Locale } from "@cocalc/util/i18n";
33+
import { unreachable } from "@cocalc/util/misc";
3234

3335
type Mode = "tex" | "md";
3436

@@ -65,6 +67,7 @@ interface Props extends Opts {
6567
}
6668

6769
function AiGenFormula({ mode, text = "", project_id, locale, cb }: Props) {
70+
const intl = useIntl();
6871
const { setLocale } = useLocalizationCtx();
6972
const is_cocalc_com = useTypedRedux("customize", "is_cocalc_com");
7073
const [model, setModel] = useLanguageModelSetting(project_id);
@@ -260,7 +263,7 @@ function AiGenFormula({ mode, text = "", project_id, locale, cb }: Props) {
260263
</Title>
261264
{enabled ? (
262265
<>
263-
Select language model:{" "}
266+
{intl.formatMessage(dialogs.select_llm)}:{" "}
264267
<LLMSelector
265268
project_id={project_id}
266269
model={model}

src/packages/frontend/frame-editors/llm/llm-selector.tsx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
} from "@cocalc/util/db-schema/llm-utils";
4545
import { round2up } from "@cocalc/util/misc";
4646
import type { CustomLLMPublic } from "@cocalc/util/types/llm";
47+
import { FormattedMessage } from "react-intl";
4748
import { getCustomLLMGroup } from "./components";
4849

4950
type SizeType = ConfigProviderProps["componentSize"];
@@ -325,21 +326,33 @@ export default function LLMSelector({
325326
}
326327

327328
return (
328-
<>
329+
<FormattedMessage
330+
id="llm-selector.help.message2"
331+
defaultMessage={`
329332
<Paragraph>
330-
The models marked as "{FREE}" do not incur any charges. However, they
331-
are rate limited to avoid abuse. The more capable models are marked "
332-
{PREMIUM}" and charged by the number of read and geenerated tokens –
333-
i.e. "pay-as-you-go" – and do not have rate limitations. Usually,
334-
these charges are very small!
333+
The models marked as "{FREE}" do not incur any charges.
334+
However, they are rate limited to avoid abuse.
335+
The more capable models are marked "{PREMIUM}" and charged by the number of
336+
read and geenerated tokens – i.e. "pay-as-you-go" – and do not have rate limitations.
337+
Usually, these charges are very small!
335338
</Paragraph>
336339
<Paragraph>
337-
Assuming a typical usage involves {input} input tokens and {output}{" "}
338-
output tokens, the price across all models ranges from $
339-
{min.toFixed(2)} to ${max.toFixed(2)} per usage, and is{" "}
340-
{calcSelected()} for the selected model {modelToName(model)}.
341-
</Paragraph>
342-
</>
340+
Assuming a typical usage involves {input} input tokens and {output} output tokens,
341+
the price across all models ranges from \${min} to \${max} per usage,
342+
and is {calc} for the selected model {name}.
343+
</Paragraph>`}
344+
values={{
345+
Paragraph: (c) => <Paragraph>{c}</Paragraph>,
346+
FREE,
347+
PREMIUM,
348+
input,
349+
output,
350+
min: min.toFixed(2),
351+
max: max.toFixed(2),
352+
calc: calcSelected(),
353+
name: modelToName(model),
354+
}}
355+
/>
343356
);
344357
}
345358

@@ -348,10 +361,12 @@ export default function LLMSelector({
348361
<HelpIcon title={"Language Model Selection"}>
349362
<>
350363
<Paragraph>
351-
This selector determines which language model will be used to
352-
generate the response. You can select from a variety of models, each
353-
with its own strengths and weaknesses. Your choice will become the
354-
default the next time you use an LLM.
364+
<FormattedMessage
365+
id="llm-selector.help.message1"
366+
defaultMessage={`This selector determines which language model will be used to generate the response.
367+
You can select from a variety of models, each with its own strengths and weaknesses.
368+
Your choice will become the default the next time you use an LLM.`}
369+
/>
355370
</Paragraph>
356371
{renderHelpPricing()}
357372
</>

src/packages/frontend/i18n/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,10 @@ export const jupyter = {
13321332
};
13331333

13341334
export const dialogs = defineMessages({
1335+
select_llm: {
1336+
id: "ai-generator.select_llm",
1337+
defaultMessage: "Select language model",
1338+
},
13351339
project_start_warning_title: {
13361340
id: "project-start-warning.title",
13371341
defaultMessage: "Start this project?",

src/packages/frontend/i18n/trans/ar_EG.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"accountaccount.account_preferences.subtitle": "قم بضبط تفضيلات الحساب أدناه. <A>قم بزيارة إعدادات حسابك لمزيد من المعلومات...</A>",
3434
"ai-generate-document.loading_kernels.error_message": "غير قادر على تحميل نوى Jupyter. تأكد من تشغيل المشروع وتثبيت Jupyter.",
3535
"ai-generate-document.modal.title": "إنشاء مستند {docName} باستخدام الذكاء الاصطناعي",
36+
"ai-generator.select_llm": "اختر نموذج اللغة",
3637
"app.fullscreen-button.tooltip": "وضع الشاشة الكاملة، يركز على المستند أو الصفحة الحالية.",
3738
"chat.chat-indicator.tooltip": "إخفاء أو إظهار محادثة المستندات",
3839
"chat.input.placeholder": "اكتب رسالة جديدة ({have_llm, select, true {الدردشة مع الذكاء الاصطناعي أو } other {}}إخطار زميل بكتابة @)...",
@@ -636,6 +637,8 @@
636637
"labels.x11_desktop": "سطح المكتب الرسومي X11",
637638
"labels.zoom_in": "تكبير",
638639
"labels.zoom_out": "التصغير",
640+
"llm-selector.help.message1": "يحدد هذا المُحدد أي نموذج لغة سيتم استخدامه لتوليد الاستجابة. يمكنك الاختيار من مجموعة متنوعة من النماذج، لكل منها نقاط قوة وضعف خاصة به. سيصبح اختيارك هو الافتراضي في المرة التالية التي تستخدم فيها LLM.",
641+
"llm-selector.help.message2": "النماذج المُعلمة بـ \"{FREE}\" لا تتطلب أي رسوم. ومع ذلك، فهي محدودة المعدل لتجنب الإساءة. النماذج الأكثر قدرة مُعلمة بـ \"{PREMIUM}\" ويتم فرض رسوم بناءً على عدد الرموز المقروءة والمُنشأة – أي \"الدفع حسب الاستخدام\" – ولا تحتوي على قيود المعدل. عادةً ما تكون هذه الرسوم صغيرة جداً!\n\nبافتراض أن الاستخدام النموذجي يتضمن {input} رموز إدخال و {output} رموز إخراج، فإن السعر عبر جميع النماذج يتراوح من ${min} إلى ${max} لكل استخدام، وهو {calc} للنموذج المحدد {name}.",
639642
"llm.cost-estimation.model_free_to_use": "هذا النموذج مجاني للاستخدام.",
640643
"menu.generic.button_bar.disable.label": "إزالة جميع الأزرار",
641644
"menu.generic.close_and_halt.label": "إغلاق وإيقاف...",
@@ -779,9 +782,17 @@
779782
"project.new.new-file-page.upload.description": "يمكنك إسقاط ملف أو أكثر هنا أو في قائمة ملفات المستكشف. اطلع على <A>التوثيق</A> لمزيد من الطرق لإضافة ملفاتك إلى مشروعك.",
780783
"project.new.new-file-page.upload.title": "تحميل الملفات إلى مشروعك",
781784
"project.open_file.what": "افتح الملف \"{path}\"",
785+
"project.page.ai-generate-document.content.label": "قدم وصفًا مفصلًا لوثيقة {docName} التي تريد إنشاؤها:",
786+
"project.page.ai-generate-document.content.placeholder": "وصف المحتوى...",
782787
"project.page.ai-generate-document.create_document.what": "إنشاء مستند {docName} \"{path}\"",
788+
"project.page.ai-generate-document.create.label": "إنشاء {docName} باستخدام",
783789
"project.page.ai-generate-document.info.title": "مولد",
784790
"project.page.ai-generate-document.info.tooltip": "افتح مولد الذكاء الاصطناعي لإنشاء مستند تلقائيًا",
791+
"project.page.ai-generate-document.preview.footer": "انقر على \"حفظ\" لتخزين معاينة المحتوى في ملف جديد بالاسم المحدد. يمكنك بعد ذلك تحرير وتشغيل المستند الحسابي كالمعتاد. انقر على \"تجاهل\" لتجاهل النتيجة والعودة إلى الخطوة السابقة.",
792+
"project.page.ai-generate-document.preview.header": "هذا معاينة للمحتوى المُنشأ.",
793+
"project.page.ai-generate-document.preview.info": "سيتم إرسال مطالبة لإنشاء المستند إلى نموذج اللغة {llm}. سترى معاينة للمحتوى الجديد، الذي ستتمكن بعد ذلك من حفظه في ملف جديد والبدء في العمل عليه. بشكل عام، يجب أن يساعدك المستند الذي تم إنشاؤه حديثًا في البدء في تحقيق هدفك.",
794+
"project.page.ai-generate-document.preview.save_message": "لقد انتهى من توليد المحتوى. يمكنك إما <B>حفظ الملف</B> بالاسم المعطى، أو تجاهل المعاينة والعودة إلى الخطوة السابقة.",
795+
"project.page.ai-generate-document.preview.saving": "{saving, select, true {يتم حفظ الملف...} other {يرجى الانتظار حتى يتم الانتهاء من التوليد...}}",
785796
"project.page.file-tab.search_file.label": "بحث",
786797
"project.page.file-tab.upgrades.flyoutTitle": "ترقيات المشروع",
787798
"project.page.flyout.log.title": "الملفات الأخيرة",

src/packages/frontend/i18n/trans/de_DE.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"account.terminal-settings.label-row.label": "Terminalfarbschema",
3333
"accountaccount.account_preferences.subtitle": "Passen Sie die Kontoeinstellungen unten an. <A>Besuchen Sie Ihre Kontokonfiguration für mehr...</A>",
3434
"ai-generate-document.loading_kernels.error_message": "Jupyter-Kernel können nicht geladen werden. Stellen Sie sicher, dass das Projekt läuft und Jupyter installiert ist.",
35-
"ai-generate-document.modal.title": "Erzeugen Sie ein {docName} Dokument mit KI",
35+
"ai-generate-document.modal.title": "Erzeuge ein {docName} Dokument mit KI",
36+
"ai-generator.select_llm": "Sprachmodell auswählen",
3637
"app.fullscreen-button.tooltip": "Vollbildmodus, fokussiert auf das aktuelle Dokument oder die aktuelle Seite",
3738
"chat.chat-indicator.tooltip": "Dokument-Chat ausblenden oder anzeigen",
3839
"chat.input.placeholder": "Schreib eine neue Nachricht ({have_llm, select, true {sprich mit einer KI oder } other {}}kontaktiere eine/n Mitarbeiter/in durch Erwähnen mit einem @)...",
@@ -636,6 +637,8 @@
636637
"labels.x11_desktop": "Grafischer X11-Desktop",
637638
"labels.zoom_in": "Vergrößern",
638639
"labels.zoom_out": "Rauszoomen",
640+
"llm-selector.help.message1": "Dieser Selektor bestimmt, welches Sprachmodell zur Generierung der Antwort verwendet wird. Sie können aus einer Vielzahl von Modellen wählen, die jeweils ihre eigenen Stärken und Schwächen haben. Ihre Wahl wird beim nächsten Mal, wenn Sie ein LLM verwenden, zum Standard.",
641+
"llm-selector.help.message2": "Die Modelle, die mit \"{FREE}\" gekennzeichnet sind, verursachen keine Kosten. Sie sind jedoch in der Rate begrenzt, um Missbrauch zu vermeiden. Die leistungsfähigeren Modelle sind mit \"{PREMIUM}\" gekennzeichnet und werden nach der Anzahl der gelesenen und generierten Tokens – also \"pay-as-you-go\" – abgerechnet und haben keine Ratenbegrenzungen. In der Regel sind diese Kosten sehr gering!\n\nAngenommen, eine typische Nutzung umfasst {input} Eingabetokens und {output} Ausgabetokens, reicht der Preis für alle Modelle von ${min} bis ${max} pro Nutzung und beträgt {calc} für das ausgewählte Modell {name}.",
639642
"llm.cost-estimation.model_free_to_use": "Dieses Modell ist kostenlos nutzbar.",
640643
"menu.generic.button_bar.disable.label": "Alle Schaltflächen entfernen",
641644
"menu.generic.close_and_halt.label": "Schließen und Stoppen...",
@@ -779,9 +782,17 @@
779782
"project.new.new-file-page.upload.description": "Sie können eine oder mehrere Dateien hier oder in der Explorer-Dateiliste ablegen. Siehe <A>Dokumentation</A> für weitere Möglichkeiten, Ihre Dateien in Ihr Projekt zu bekommen.",
780783
"project.new.new-file-page.upload.title": "Dateien in Ihr Projekt hochladen",
781784
"project.open_file.what": "öffne die Datei \"{path}\"",
785+
"project.page.ai-generate-document.content.label": "Geben Sie eine detaillierte Beschreibung des {docName}-Dokuments, das Sie erstellen möchten:",
786+
"project.page.ai-generate-document.content.placeholder": "Inhalt beschreiben...",
782787
"project.page.ai-generate-document.create_document.what": "erstelle das {docName} Dokument \"{path}\"",
788+
"project.page.ai-generate-document.create.label": "Erstelle {docName} mit",
783789
"project.page.ai-generate-document.info.title": "Generator",
784790
"project.page.ai-generate-document.info.tooltip": "Öffnen Sie den AI-Generator, um automatisch ein Dokument zu erstellen.",
791+
"project.page.ai-generate-document.preview.footer": "Klicken Sie auf \"Speichern\", um die Vorschau des Inhalts in einer neuen Datei mit dem angegebenen Dateinamen zu speichern. Sie können dann das Rechendokument wie gewohnt bearbeiten und ausführen. Klicken Sie auf \"Verwerfen\", um das Ergebnis zu ignorieren und zum vorherigen Schritt zurückzukehren.",
792+
"project.page.ai-generate-document.preview.header": "Dies ist eine Vorschau des generierten Inhalts.",
793+
"project.page.ai-generate-document.preview.info": "Eine Aufforderung zur Erstellung des Dokuments wird an das {llm} Sprachmodell gesendet. Sie sehen eine Vorschau des neuen Inhalts, die Sie dann in einer neuen Datei speichern und daran arbeiten können. Insgesamt sollte das neu erstellte Dokument Ihnen helfen, Ihr Ziel zu erreichen.",
794+
"project.page.ai-generate-document.preview.save_message": "Es hat die Inhalte fertiggestellt. Sie können entweder die Datei mit dem angegebenen Dateinamen <B>speichern</B> oder die Vorschau verwerfen und zum vorherigen Schritt zurückkehren.",
795+
"project.page.ai-generate-document.preview.saving": "{saving, select, true {Die Datei wird gespeichert...} other {Bitte warten Sie, bis vollständig generiert...}}",
785796
"project.page.file-tab.search_file.label": "Suche",
786797
"project.page.file-tab.upgrades.flyoutTitle": "Projekt-Upgrades",
787798
"project.page.flyout.log.title": "Kürzlich bearbeitete Dateien",

src/packages/frontend/i18n/trans/es_ES.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"accountaccount.account_preferences.subtitle": "Ajusta las preferencias de tu cuenta a continuación. <A>Visita la configuración de tu cuenta para más...</A>",
3434
"ai-generate-document.loading_kernels.error_message": "No se pueden cargar los núcleos de Jupyter. Asegúrese de que el proyecto esté en ejecución y Jupyter esté instalado.",
3535
"ai-generate-document.modal.title": "Generar un documento {docName} usando IA",
36+
"ai-generator.select_llm": "Seleccionar modelo de idioma",
3637
"app.fullscreen-button.tooltip": "Modo de pantalla completa, centrado en el documento o página actual.",
3738
"chat.chat-indicator.tooltip": "Ocultar o Mostrar Chat del Documento",
3839
"chat.input.placeholder": "Escribe un nuevo mensaje ({have_llm, select, true {chatea con AI o } other {}}notifica a un colaborador escribiendo @)...",
@@ -636,6 +637,8 @@
636637
"labels.x11_desktop": "Escritorio gráfico X11",
637638
"labels.zoom_in": "Acercar",
638639
"labels.zoom_out": "Disminuir zoom",
640+
"llm-selector.help.message1": "Este selector determina qué modelo de lenguaje se usará para generar la respuesta. Puedes seleccionar entre una variedad de modelos, cada uno con sus propias fortalezas y debilidades. Tu elección se convertirá en la predeterminada la próxima vez que uses un LLM.",
641+
"llm-selector.help.message2": "<Paragraph> Los modelos marcados como \"{FREE}\" no generan ningún costo. Sin embargo, tienen limitaciones de velocidad para evitar abusos. Los modelos más capaces están marcados como \"{PREMIUM}\" y se cobran por el número de tokens leídos y generados, es decir, \"pagar por uso\", y no tienen limitaciones de velocidad. ¡Usualmente, estos cargos son muy pequeños! </Paragraph> <Paragraph> Suponiendo que un uso típico involucra {input} tokens de entrada y {output} tokens de salida, el precio entre todos los modelos varía de ${min} a ${max} por uso, y es {calc} para el modelo seleccionado {name}. </Paragraph>",
639642
"llm.cost-estimation.model_free_to_use": "Este modelo es gratuito.",
640643
"menu.generic.button_bar.disable.label": "Eliminar Todos los Botones",
641644
"menu.generic.close_and_halt.label": "Cerrar y Detener",
@@ -779,9 +782,17 @@
779782
"project.new.new-file-page.upload.description": "Puedes soltar uno o más archivos aquí o en la lista de archivos del Explorador. Consulta la <A>documentación</A> para más formas de añadir tus archivos a tu proyecto.",
780783
"project.new.new-file-page.upload.title": "Subir archivos a tu proyecto",
781784
"project.open_file.what": "abre el archivo \"{path}\"",
785+
"project.page.ai-generate-document.content.label": "Proporcione una descripción detallada del documento {docName} que desea crear:",
786+
"project.page.ai-generate-document.content.placeholder": "Describir el contenido...",
782787
"project.page.ai-generate-document.create_document.what": "crear el documento {docName} \"{path}\"",
788+
"project.page.ai-generate-document.create.label": "Crear {docName} usando",
783789
"project.page.ai-generate-document.info.title": "Generador",
784790
"project.page.ai-generate-document.info.tooltip": "Abre el Generador de IA para crear un documento automáticamente.",
791+
"project.page.ai-generate-document.preview.footer": "Haz clic en \"guardar\" para almacenar la vista previa del contenido en un nuevo archivo con el nombre de archivo dado. Luego puedes editar y ejecutar el documento computacional como de costumbre. Haz clic en \"descartar\" para ignorar el resultado y volver al paso anterior.",
792+
"project.page.ai-generate-document.preview.header": "Esta es una vista previa del contenido generado.",
793+
"project.page.ai-generate-document.preview.info": "Se enviará un aviso al modelo de lenguaje {llm} para generar el documento. Verás una vista previa del nuevo contenido, que luego podrás guardar en un nuevo archivo y comenzar a trabajar en él. En general, el documento recién creado debería ayudarte a comenzar a lograr tu objetivo.",
794+
"project.page.ai-generate-document.preview.save_message": "Terminó de generar el contenido. Puedes <B>guardar el archivo</B> con el nombre de archivo dado, o descartar la vista previa y volver al paso anterior.",
795+
"project.page.ai-generate-document.preview.saving": "{saving, select, true {El archivo se está guardando...} other {Por favor, espera hasta que se genere completamente...}}",
785796
"project.page.file-tab.search_file.label": "Buscar",
786797
"project.page.file-tab.upgrades.flyoutTitle": "Mejoras del Proyecto",
787798
"project.page.flyout.log.title": "Archivos Recientes",

0 commit comments

Comments
 (0)