Skip to content

Commit

Permalink
✨ feat: add SenseNova (商汤) model provider (#4162)
Browse files Browse the repository at this point in the history
* ✨ feat: add SenseCore (商汤) model provider

* 💄 style: update model list, fix `frequency_penalty`, `temperature`, `top_p` value range

* 🔨 chore: add jwt api token calculate

* 🔨 chore: remove `SENSECORE_API_KEY` ENV

* Update authToken.ts

* 🔨 chore: add debug logs

* ♻️ refactor: rollback changes, remove JWT

* 👷 build: add docker ENV, `SENSECORE_API_KEY` & `SENSECORE_MODEL_LIST`

* 🔨 chore: cleanup

* 🔨 chore: cleanup

* 🔨 chore: rename `sensecore` to `sensenova`

* 💄 style: update model list

* 💄 style: sort model list

* ✨ feat: add jwt token generator for SenseNova

* ♻️ refactor: support two different type of `API TOKEN`

* Update authToken.ts

* 💄 style: add custom form for SenseNova

* 💄 style: fix custom form calling & adjust icon size

* 🐛 fix: fix CI error

* 💄 style: adjust icon size

* 🐛 fix: fix `sensenovaAccessKeySecret` not store in key

* 🐛 fix: try to fix loading key from ENV

* 🐛 fix: try to fix loading key from ENV

* 🐛 fix: seems be the root cause, typo

* 💄 style: remove title

* 🐛 fix: fix build error

* 🔨 chore: add i18n

* 🐛 fix: fix PR conflicts

* 🐛 fix: fix route ci error

* 🐛 fix: fix PR conflicts

* ♻️ refactor: move `generateJwtTokenSenseNova` to `LobeSenseNovaAI.generateJWTToken`

* Update index.ts

* rollback changes, submit wrong branch

* 🐛 fix: fix CI error, refactor the chat webapi

* ♻️ refactor: replace deprecated module `crypto-js` to `crypto-es`

* Revert "♻️ refactor: replace deprecated module `crypto-js` to `crypto-es`"

This reverts commit 9655c92.

* ♻️ refactor: replace `crypto-js` to `jose`, only support ENV now (Part 1)

* Revert "♻️ refactor: replace `crypto-js` to `jose`, only support ENV now (Part 1)"

* ♻️ refactor: using `jose` to generate the APIToken

* 🔨 chore: remove debug code

* 🔨 chore: cleanup package, remove `crypto-js`

* 🔨 chore: add unit test

* 🔨 chore: optimize jwt generate process
  • Loading branch information
hezhijie0327 authored Oct 25, 2024
1 parent b2fbde4 commit 7a4e0b3
Show file tree
Hide file tree
Showing 76 changed files with 1,534 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ ENV \
PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \
# Qwen
QWEN_API_KEY="" QWEN_MODEL_LIST="" \
# SenseNova
SENSENOVA_ACCESS_KEY_ID="" SENSENOVA_ACCESS_KEY_SECRET="" SENSENOVA_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Spark
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ ENV \
PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \
# Qwen
QWEN_API_KEY="" QWEN_MODEL_LIST="" \
# SenseNova
SENSENOVA_ACCESS_KEY_ID="" SENSENOVA_ACCESS_KEY_SECRET="" SENSENOVA_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Spark
Expand Down
16 changes: 16 additions & 0 deletions locales/ar/modelProvider.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@
"title": "Download specified Ollama model"
}
},
"sensenova": {
"sensenovaAccessKeyID": {
"desc": "أدخل معرف مفتاح الوصول لـ SenseNova",
"placeholder": "معرف مفتاح الوصول لـ SenseNova",
"title": "معرف مفتاح الوصول"
},
"sensenovaAccessKeySecret": {
"desc": "أدخل سر مفتاح الوصول لـ SenseNova",
"placeholder": "سر مفتاح الوصول لـ SenseNova",
"title": "سر مفتاح الوصول"
},
"unlock": {
"description": "أدخل معرف مفتاح الوصول / سر مفتاح الوصول لبدء الجلسة. التطبيق لن يسجل إعدادات المصادقة الخاصة بك",
"title": "استخدم معلومات مصادقة SenseNova المخصصة"
}
},
"wenxin": {
"accessKey": {
"desc": "أدخل مفتاح الوصول من منصة بايدو تشيانفان",
Expand Down
27 changes: 27 additions & 0 deletions locales/ar/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@
"Qwen/Qwen2.5-Math-72B-Instruct": {
"description": "Qwen2.5-Math يركز على حل المشكلات في مجال الرياضيات، ويقدم إجابات احترافية للأسئلة الصعبة."
},
"SenseChat": {
"description": "نموذج الإصدار الأساسي (V4)، بطول سياق 4K، يمتلك قدرات قوية وعامة."
},
"SenseChat-128K": {
"description": "نموذج الإصدار الأساسي (V4)، بطول سياق 128K، يتفوق في مهام فهم وتوليد النصوص الطويلة."
},
"SenseChat-32K": {
"description": "نموذج الإصدار الأساسي (V4)، بطول سياق 32K، يمكن استخدامه بمرونة في مختلف السيناريوهات."
},
"SenseChat-5": {
"description": "أحدث إصدار من النموذج (V5.5)، بطول سياق 128K، مع تحسينات ملحوظة في القدرة على الاستدلال الرياضي، المحادثات باللغة الإنجليزية، اتباع التعليمات وفهم النصوص الطويلة، مما يجعله في مستوى GPT-4o."
},
"SenseChat-5-Cantonese": {
"description": "بطول سياق 32K، يتفوق في فهم المحادثات باللغة الكانتونية مقارنة بـ GPT-4، ويضاهي GPT-4 Turbo في مجالات المعرفة، الاستدلال، الرياضيات وكتابة الأكواد."
},
"SenseChat-Character": {
"description": "نموذج النسخة القياسية، بطول سياق 8K، بسرعة استجابة عالية."
},
"SenseChat-Character-Pro": {
"description": "نموذج النسخة المتقدمة، بطول سياق 32K، مع تحسين شامل في القدرات، يدعم المحادثات باللغة الصينية والإنجليزية."
},
"SenseChat-Turbo": {
"description": "مناسب للأسئلة السريعة، وسيناريوهات ضبط النموذج."
},
"SenseChat-Vision": {
"description": "أحدث إصدار من النموذج (V5.5)، بطول سياق 16K، يدعم إدخال صور متعددة، ويحقق تحسينات شاملة في القدرات الأساسية للنموذج، مع تحسينات كبيرة في التعرف على خصائص الكائنات، العلاقات المكانية، التعرف على أحداث الحركة، فهم المشاهد، التعرف على المشاعر، الاستدلال المنطقي وفهم النصوص وتوليدها."
},
"THUDM/glm-4-9b-chat": {
"description": "GLM-4 9B هو إصدار مفتوح المصدر، يوفر تجربة حوار محسنة لتطبيقات الحوار."
},
Expand Down
1 change: 1 addition & 0 deletions locales/ar/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"qwen": {
"description": "Qwen هو نموذج لغة ضخم تم تطويره ذاتيًا بواسطة Alibaba Cloud، يتمتع بقدرات قوية في فهم وتوليد اللغة الطبيعية. يمكنه الإجابة على مجموعة متنوعة من الأسئلة، وكتابة المحتوى، والتعبير عن الآراء، وكتابة الشيفرات، ويؤدي دورًا في مجالات متعددة."
},
"sensenova": {},
"siliconcloud": {
"description": "تسعى SiliconFlow إلى تسريع الذكاء الاصطناعي العام (AGI) لفائدة البشرية، من خلال تحسين كفاءة الذكاء الاصطناعي على نطاق واسع باستخدام حزمة GenAI سهلة الاستخدام وذات التكلفة المنخفضة."
},
Expand Down
16 changes: 16 additions & 0 deletions locales/bg-BG/modelProvider.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@
"title": "Download specified Ollama model"
}
},
"sensenova": {
"sensenovaAccessKeyID": {
"desc": "Въведете SenseNova Access Key ID",
"placeholder": "SenseNova Access Key ID",
"title": "Access Key ID"
},
"sensenovaAccessKeySecret": {
"desc": "Въведете SenseNova Access Key Secret",
"placeholder": "SenseNova Access Key Secret",
"title": "Access Key Secret"
},
"unlock": {
"description": "Въведете вашия Access Key ID / Access Key Secret, за да започнете сесия. Приложението няма да записва вашите конфигурации за удостоверяване",
"title": "Използвайте персонализирана информация за удостоверяване на SenseNova"
}
},
"wenxin": {
"accessKey": {
"desc": "Въведете Access Key от платформата Baidu Qianfan",
Expand Down
27 changes: 27 additions & 0 deletions locales/bg-BG/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@
"Qwen/Qwen2.5-Math-72B-Instruct": {
"description": "Qwen2.5-Math се фокусира върху решаването на математически проблеми, предоставяйки професионални отговори на трудни задачи."
},
"SenseChat": {
"description": "Основна версия на модела (V4), с контекстна дължина 4K, с мощни общи способности."
},
"SenseChat-128K": {
"description": "Основна версия на модела (V4), с контекстна дължина 128K, показваща отлични резултати в задачи за разбиране и генериране на дълги текстове."
},
"SenseChat-32K": {
"description": "Основна версия на модела (V4), с контекстна дължина 32K, гъвкаво приложима в различни сцени."
},
"SenseChat-5": {
"description": "Най-новата версия на модела (V5.5), с контекстна дължина 128K, значително подобрена способност в области като математическо разсъждение, английски разговори, следване на инструкции и разбиране на дълги текстове, сравнима с GPT-4o."
},
"SenseChat-5-Cantonese": {
"description": "С контекстна дължина 32K, надминава GPT-4 в разбирането на разговори на кантонски, сравним с GPT-4 Turbo в множество области като знания, разсъждение, математика и писане на код."
},
"SenseChat-Character": {
"description": "Стандартна версия на модела, с контекстна дължина 8K, с висока скорост на отговор."
},
"SenseChat-Character-Pro": {
"description": "Премиум версия на модела, с контекстна дължина 32K, с напълно подобрени способности, поддържаща разговори на китайски/английски."
},
"SenseChat-Turbo": {
"description": "Подходящ за бързи въпроси и отговори, сцени на фино настройване на модела."
},
"SenseChat-Vision": {
"description": "Най-новата версия на модела (V5.5), с контекстна дължина 16K, поддържа вход с множество изображения, напълно реализирана оптимизация на основните способности на модела, с голямо подобрение в разпознаването на свойства на обекти, пространствени отношения, разпознаване на действия, разбиране на сцени, разпознаване на емоции, логическо разсъждение и генериране на текст."
},
"THUDM/glm-4-9b-chat": {
"description": "GLM-4 9B е отворен код версия, предоставяща оптимизирано изживяване в разговорните приложения."
},
Expand Down
1 change: 1 addition & 0 deletions locales/bg-BG/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"qwen": {
"description": "Qwen е самостоятелно разработен свръхголям езиков модел на Alibaba Cloud, с мощни способности за разбиране и генериране на естествен език. Може да отговаря на различни въпроси, да създава текстово съдържание, да изразява мнения и да пише код, играейки роля в множество области."
},
"sensenova": {},
"siliconcloud": {
"description": "SiliconFlow се стреми да ускори AGI, за да бъде от полза за човечеството, повишавайки ефективността на мащабния AI чрез лесен за използване и икономически изгоден GenAI стек."
},
Expand Down
16 changes: 16 additions & 0 deletions locales/de-DE/modelProvider.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@
"title": "Download specified Ollama model"
}
},
"sensenova": {
"sensenovaAccessKeyID": {
"desc": "Geben Sie die SenseNova Access Key ID ein",
"placeholder": "SenseNova Access Key ID",
"title": "Access Key ID"
},
"sensenovaAccessKeySecret": {
"desc": "Geben Sie den SenseNova Access Key Secret ein",
"placeholder": "SenseNova Access Key Secret",
"title": "Access Key Secret"
},
"unlock": {
"description": "Geben Sie Ihre Access Key ID / Access Key Secret ein, um die Sitzung zu starten. Die Anwendung speichert Ihre Authentifizierungsinformationen nicht",
"title": "Verwenden Sie benutzerdefinierte SenseNova Authentifizierungsinformationen"
}
},
"wenxin": {
"accessKey": {
"desc": "Geben Sie den Access Key der Baidu Qianfan-Plattform ein",
Expand Down
27 changes: 27 additions & 0 deletions locales/de-DE/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@
"Qwen/Qwen2.5-Math-72B-Instruct": {
"description": "Qwen2.5-Math konzentriert sich auf die Problemlösung im Bereich Mathematik und bietet professionelle Lösungen für schwierige Aufgaben."
},
"SenseChat": {
"description": "Basisversion des Modells (V4) mit 4K Kontextlänge, die über starke allgemeine Fähigkeiten verfügt."
},
"SenseChat-128K": {
"description": "Basisversion des Modells (V4) mit 128K Kontextlänge, das in Aufgaben des Verständnisses und der Generierung langer Texte hervorragende Leistungen zeigt."
},
"SenseChat-32K": {
"description": "Basisversion des Modells (V4) mit 32K Kontextlänge, flexibel einsetzbar in verschiedenen Szenarien."
},
"SenseChat-5": {
"description": "Die neueste Modellversion (V5.5) mit 128K Kontextlänge hat signifikante Verbesserungen in den Bereichen mathematische Schlussfolgerungen, englische Konversation, Befolgen von Anweisungen und Verständnis langer Texte, vergleichbar mit GPT-4o."
},
"SenseChat-5-Cantonese": {
"description": "Mit 32K Kontextlänge übertrifft es GPT-4 im Verständnis von Konversationen auf Kantonesisch und kann in mehreren Bereichen wie Wissen, Schlussfolgerungen, Mathematik und Programmierung mit GPT-4 Turbo konkurrieren."
},
"SenseChat-Character": {
"description": "Standardmodell mit 8K Kontextlänge und hoher Reaktionsgeschwindigkeit."
},
"SenseChat-Character-Pro": {
"description": "Premium-Modell mit 32K Kontextlänge, das umfassende Verbesserungen in den Fähigkeiten bietet und sowohl chinesische als auch englische Konversationen unterstützt."
},
"SenseChat-Turbo": {
"description": "Geeignet für schnelle Fragen und Antworten sowie Szenarien zur Feinabstimmung des Modells."
},
"SenseChat-Vision": {
"description": "Die neueste Modellversion (V5.5) mit 16K Kontextlänge unterstützt die Eingabe mehrerer Bilder und optimiert umfassend die grundlegenden Fähigkeiten des Modells. Es hat erhebliche Fortschritte in der Erkennung von Objektattributen, räumlichen Beziehungen, Erkennung von Handlungsereignissen, Szenenverständnis, Emotionserkennung, logischem Wissen und Textverständnis und -generierung erzielt."
},
"THUDM/glm-4-9b-chat": {
"description": "GLM-4 9B ist die Open-Source-Version, die ein optimiertes Dialogerlebnis für Konversationsanwendungen bietet."
},
Expand Down
1 change: 1 addition & 0 deletions locales/de-DE/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"qwen": {
"description": "Tongyi Qianwen ist ein von Alibaba Cloud selbst entwickeltes, groß angelegtes Sprachmodell mit starken Fähigkeiten zur Verarbeitung und Generierung natürlicher Sprache. Es kann eine Vielzahl von Fragen beantworten, Texte erstellen, Meinungen äußern und Code schreiben und spielt in mehreren Bereichen eine Rolle."
},
"sensenova": {},
"siliconcloud": {
"description": "SiliconFlow hat sich zum Ziel gesetzt, AGI zu beschleunigen, um der Menschheit zu dienen, und die Effizienz großangelegter KI durch eine benutzerfreundliche und kostengünstige GenAI-Stack zu steigern."
},
Expand Down
16 changes: 16 additions & 0 deletions locales/en-US/modelProvider.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@
"title": "Download specified Ollama model"
}
},
"sensenova": {
"sensenovaAccessKeyID": {
"desc": "Enter your SenseNova Access Key ID",
"placeholder": "SenseNova Access Key ID",
"title": "Access Key ID"
},
"sensenovaAccessKeySecret": {
"desc": "Enter your SenseNova Access Key Secret",
"placeholder": "SenseNova Access Key Secret",
"title": "Access Key Secret"
},
"unlock": {
"description": "Input your Access Key ID / Access Key Secret to start the session. The application will not record your authentication configuration.",
"title": "Use Custom SenseNova Authentication Information"
}
},
"wenxin": {
"accessKey": {
"desc": "Enter the Access Key from the Baidu Qianfan platform",
Expand Down
27 changes: 27 additions & 0 deletions locales/en-US/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@
"Qwen/Qwen2.5-Math-72B-Instruct": {
"description": "Qwen2.5-Math focuses on problem-solving in the field of mathematics, providing expert solutions for challenging problems."
},
"SenseChat": {
"description": "Basic version model (V4) with a context length of 4K, featuring strong general capabilities."
},
"SenseChat-128K": {
"description": "Basic version model (V4) with a context length of 128K, excelling in long text comprehension and generation tasks."
},
"SenseChat-32K": {
"description": "Basic version model (V4) with a context length of 32K, flexibly applicable to various scenarios."
},
"SenseChat-5": {
"description": "The latest version model (V5.5) with a context length of 128K shows significant improvements in mathematical reasoning, English conversation, instruction following, and long text comprehension, comparable to GPT-4o."
},
"SenseChat-5-Cantonese": {
"description": "With a context length of 32K, it surpasses GPT-4 in Cantonese conversation comprehension and is competitive with GPT-4 Turbo in knowledge, reasoning, mathematics, and code writing across multiple domains."
},
"SenseChat-Character": {
"description": "Standard version model with an 8K context length and high response speed."
},
"SenseChat-Character-Pro": {
"description": "Advanced version model with a context length of 32K, offering comprehensive capability enhancements and supporting both Chinese and English conversations."
},
"SenseChat-Turbo": {
"description": "Suitable for fast question answering and model fine-tuning scenarios."
},
"SenseChat-Vision": {
"description": "The latest version model (V5.5) with a context length of 16K supports multi-image input and fully optimizes the model's foundational capabilities, achieving substantial improvements in object attribute recognition, spatial relationships, action event recognition, scene understanding, emotion recognition, logical reasoning, and text comprehension and generation."
},
"THUDM/glm-4-9b-chat": {
"description": "GLM-4 9B is an open-source version that provides an optimized conversational experience for chat applications."
},
Expand Down
1 change: 1 addition & 0 deletions locales/en-US/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"qwen": {
"description": "Tongyi Qianwen is a large-scale language model independently developed by Alibaba Cloud, featuring strong natural language understanding and generation capabilities. It can answer various questions, create written content, express opinions, and write code, playing a role in multiple fields."
},
"sensenova": {},
"siliconcloud": {
"description": "SiliconFlow is dedicated to accelerating AGI for the benefit of humanity, enhancing large-scale AI efficiency through an easy-to-use and cost-effective GenAI stack."
},
Expand Down
16 changes: 16 additions & 0 deletions locales/es-ES/modelProvider.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@
"title": "Download specified Ollama model"
}
},
"sensenova": {
"sensenovaAccessKeyID": {
"desc": "Introduce el ID de clave de acceso de SenseNova",
"placeholder": "ID de clave de acceso de SenseNova",
"title": "ID de clave de acceso"
},
"sensenovaAccessKeySecret": {
"desc": "Introduce la clave secreta de acceso de SenseNova",
"placeholder": "Clave secreta de acceso de SenseNova",
"title": "Clave secreta de acceso"
},
"unlock": {
"description": "Introduce tu ID de clave de acceso / clave secreta de acceso para comenzar la sesión. La aplicación no registrará tu configuración de autenticación",
"title": "Usar información de autenticación personalizada de SenseNova"
}
},
"wenxin": {
"accessKey": {
"desc": "Introduce la Access Key de la plataforma Qianfan de Baidu",
Expand Down
Loading

0 comments on commit 7a4e0b3

Please sign in to comment.