diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b118a4d..a01a49b 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -1,4 +1,6 @@ -name: Docker CI + + +name: Node.js CI on: pull_request: @@ -6,28 +8,20 @@ on: - "develop" jobs: - docker: + test: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Checkout code uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '20' - name: Install dependencies run: npm install - - name: Build project - run: npm run build - - name: Run tests - run: npm run test \ No newline at end of file + run: npm run test + diff --git a/README.md b/README.md index 94114b8..6475d98 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Latest Features: +# Latest Features - Added ability to upload files for translation - Added ability to download translations @@ -11,45 +11,46 @@ # OmniPoly -Welcome to a solution for translation and language enhancement tool. This project integrates Libre Translate for accurate translations, LanguageTool for grammar and style checks, and AI Translation for modern touch of sentiment analysis and interesting sentences extraction. +Welcome to **OmniPoly**! This project is a comprehensive solution for translation and language enhancement. It integrates: -Key features include: +## Key Features - Translation: Text translation across multiple languages (see: [libretranslate](https://github.com/LibreTranslate/LibreTranslate)). - Grammar Checking: Ensures your text is not only translated but also reads well with proper grammar and style (see: [languagetool](https://github.com/languagetool-org/languagetool)). - AI-Powered Insights: Utilizes Large Language Models to analyze sentiments and extract interesting sentences, adding depth to your translations (see: [ollama](https://github.com/ollama/ollama)). -The project started with the fact that I didn't like the standard app coming with Libre Translate (i.e. it didn't remember my previous choices). So I've decided to make my own. Eventually I've found out about self-hosted LanguageTool, and then I've learned that it does not have any frontend... +The project started because I wasn't satisfied with the standard app that comes with Libre Translate (it didn't remember my previous choices). I decided to create my own solution. Eventually, I discovered self-hosted LanguageTool and learned that it lacked a frontend interface.
-
+
-
+
-
+
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 | + +1x +7x + + + + +3x + + + + + + + + + + +2x + +7x + + + + +2x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2x + +2x +2x +2x + + + + + +7x +2x + +7x + + + + + + | import { LangChoice } from "./types";
+
+export const API = () => {
+ const getTranslation = (
+ source: LangChoice,
+ target: LangChoice,
+ text: string
+ ) =>
+ fetch(`/api/libretranslate/translate`, {
+ method: "POST",
+ body: JSON.stringify({
+ q: text,
+ source: source.code,
+ target: target.code,
+ format: "text",
+ alternatives: 3,
+ api_key: "",
+ }),
+ headers: { "Content-Type": "application/json" },
+ }).then((data) => data.json());
+
+ const getOllamaTranslation = (
+ _source: LangChoice,
+ target: LangChoice,
+ text: string
+ ) =>
+ fetch(`/api/ollama/generate`, {
+ method: "POST",
+ body: JSON.stringify({
+ prompt: `
+ You are an advanced language model tasked with translating the provided text into ${target.name}.
+
+First, you will provide a translation of the provided text and highlight any notable words or phrases from the source language within the translation using square brackets [].
+
+For each highlighted word or phrase, provide a brief explanation of its significance, context, or usage. Ensure that these explanations are in ${target.name} language.
+
+### Text to Translate:
+${text}
+
+### Example:
+
+#### Input:
+**Text to Translate:**
+"Climate change is one of the most pressing issues of our time. It affects everything from weather patterns to agricultural productivity."
+
+**Target Language:**
+Spanish
+
+#### Output:
+{
+ translation: "Cambio climático es uno de los problemas más urgentes[1] de nuestra época. Afecta todo, desde los patrones climáticos hasta la productividad agrícola[2].",
+ notable words:
+ [
+ {
+ word: "urgentes (pressing issues)",
+ explanation: "Pressing issues" are problems that require immediate attention and action. In this context, it emphasizes the urgency of addressing climate change.
+ },
+ {
+ word: "productividad agrícola (agricultural productivity)",
+ explanation: "Agricultural productivity" refers to the efficiency of agricultural output relative to input. Climate change can significantly affect crop yields and food security, making this a crucial area of concern.
+ }
+ ]
+}
+ `,
+ format: {
+ type: "object",
+ properties: {
+ translation: {
+ type: "string",
+ },
+ "notable words": {
+ type: "array",
+ items: {
+ type: "object",
+ properties: {
+ word: {
+ type: "string",
+ },
+ explanation: {
+ type: "string",
+ },
+ },
+ required: ["word", "explanation"],
+ },
+ },
+ },
+ required: ["translation", "notable words"],
+ },
+ stream: false,
+ }),
+ headers: { "Content-Type": "application/json" },
+ })
+ .then((data) => data.json())
+ .then((data) => {
+ const res = JSON.parse(data.response);
+ console.log({ res });
+ return {
+ translatedText: res.translation,
+ notableWords: res["notable words"],
+ };
+ });
+
+ const getLanguages = () =>
+ fetch(`/api/libretranslate/languages`).then((data) => data.json());
+
+ return {
+ getTranslation,
+ getLanguages,
+ getOllamaTranslation,
+ };
+};
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +