mirror of https://github.com/langgenius/dify.git
Merge remote-tracking branch 'origin/main' into feat/tool-plugin-oauth
This commit is contained in:
commit
0532135a9c
|
|
@ -427,6 +427,9 @@ class PluginService:
|
|||
|
||||
manager = PluginInstaller()
|
||||
|
||||
# collect actual plugin_unique_identifiers
|
||||
actual_plugin_unique_identifiers = []
|
||||
metas = []
|
||||
features = FeatureService.get_system_features()
|
||||
|
||||
# check if already downloaded
|
||||
|
|
@ -437,6 +440,8 @@ class PluginService:
|
|||
# check if the plugin is available to install
|
||||
PluginService._check_plugin_installation_scope(plugin_decode_response.verification)
|
||||
# already downloaded, skip
|
||||
actual_plugin_unique_identifiers.append(plugin_unique_identifier)
|
||||
metas.append({"plugin_unique_identifier": plugin_unique_identifier})
|
||||
except Exception:
|
||||
# plugin not installed, download and upload pkg
|
||||
pkg = download_plugin_pkg(plugin_unique_identifier)
|
||||
|
|
@ -447,17 +452,15 @@ class PluginService:
|
|||
)
|
||||
# check if the plugin is available to install
|
||||
PluginService._check_plugin_installation_scope(response.verification)
|
||||
# use response plugin_unique_identifier
|
||||
actual_plugin_unique_identifiers.append(response.unique_identifier)
|
||||
metas.append({"plugin_unique_identifier": response.unique_identifier})
|
||||
|
||||
return manager.install_from_identifiers(
|
||||
tenant_id,
|
||||
plugin_unique_identifiers,
|
||||
actual_plugin_unique_identifiers,
|
||||
PluginInstallationSource.Marketplace,
|
||||
[
|
||||
{
|
||||
"plugin_unique_identifier": plugin_unique_identifier,
|
||||
}
|
||||
for plugin_unique_identifier in plugin_unique_identifiers
|
||||
],
|
||||
metas,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React, { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import produce from 'immer'
|
||||
import { useContext } from 'use-context-selector'
|
||||
|
||||
import { Microphone01 } from '@/app/components/base/icons/src/vender/features'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import { SupportUploadFileTypes } from '@/app/components/workflow/types'
|
||||
import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks'
|
||||
import Switch from '@/app/components/base/switch'
|
||||
|
||||
const ConfigAudio: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const file = useFeatures(s => s.features.file)
|
||||
const featuresStore = useFeaturesStore()
|
||||
const { isShowAudioConfig } = useContext(ConfigContext)
|
||||
|
||||
const isAudioEnabled = file?.allowed_file_types?.includes(SupportUploadFileTypes.audio) ?? false
|
||||
|
||||
const handleChange = useCallback((value: boolean) => {
|
||||
const {
|
||||
features,
|
||||
setFeatures,
|
||||
} = featuresStore!.getState()
|
||||
|
||||
const newFeatures = produce(features, (draft) => {
|
||||
if (value) {
|
||||
draft.file!.allowed_file_types = Array.from(new Set([
|
||||
...(draft.file?.allowed_file_types || []),
|
||||
SupportUploadFileTypes.audio,
|
||||
]))
|
||||
}
|
||||
else {
|
||||
draft.file!.allowed_file_types = draft.file!.allowed_file_types?.filter(
|
||||
type => type !== SupportUploadFileTypes.audio,
|
||||
)
|
||||
}
|
||||
if (draft.file)
|
||||
draft.file.enabled = (draft.file.allowed_file_types?.length ?? 0) > 0
|
||||
})
|
||||
setFeatures(newFeatures)
|
||||
}, [featuresStore])
|
||||
|
||||
if (!isShowAudioConfig)
|
||||
return null
|
||||
|
||||
return (
|
||||
<div className='mt-2 flex items-center gap-2 rounded-xl border-l-[0.5px] border-t-[0.5px] bg-background-section-burn p-2'>
|
||||
<div className='shrink-0 p-1'>
|
||||
<div className='rounded-lg border-[0.5px] border-divider-subtle bg-util-colors-violet-violet-600 p-1 shadow-xs'>
|
||||
<Microphone01 className='h-4 w-4 text-text-primary-on-surface' />
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex grow items-center'>
|
||||
<div className='system-sm-semibold mr-1 text-text-secondary'>{t('appDebug.feature.audioUpload.title')}</div>
|
||||
<Tooltip
|
||||
popupContent={
|
||||
<div className='w-[180px]' >
|
||||
{t('appDebug.feature.audioUpload.description')}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className='flex shrink-0 items-center'>
|
||||
<div className='ml-1 mr-3 h-3.5 w-[1px] bg-divider-subtle'></div>
|
||||
<Switch
|
||||
defaultValue={isAudioEnabled}
|
||||
onChange={handleChange}
|
||||
size='md'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default React.memo(ConfigAudio)
|
||||
|
|
@ -8,6 +8,7 @@ import DatasetConfig from '../dataset-config'
|
|||
import HistoryPanel from '../config-prompt/conversation-history/history-panel'
|
||||
import ConfigVision from '../config-vision'
|
||||
import ConfigDocument from './config-document'
|
||||
import ConfigAudio from './config-audio'
|
||||
import AgentTools from './agent/agent-tools'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import ConfigPrompt from '@/app/components/app/configuration/config-prompt'
|
||||
|
|
@ -85,6 +86,8 @@ const Config: FC = () => {
|
|||
|
||||
<ConfigDocument />
|
||||
|
||||
<ConfigAudio />
|
||||
|
||||
{/* Chat History */}
|
||||
{isAdvancedMode && isChatApp && modelModeType === ModelModeType.completion && (
|
||||
<HistoryPanel
|
||||
|
|
|
|||
|
|
@ -474,6 +474,7 @@ const Configuration: FC = () => {
|
|||
|
||||
const isShowVisionConfig = !!currModel?.features?.includes(ModelFeatureEnum.vision)
|
||||
const isShowDocumentConfig = !!currModel?.features?.includes(ModelFeatureEnum.document)
|
||||
const isShowAudioConfig = !!currModel?.features?.includes(ModelFeatureEnum.audio)
|
||||
const isAllowVideoUpload = !!currModel?.features?.includes(ModelFeatureEnum.video)
|
||||
// *** web app features ***
|
||||
const featuresData: FeaturesData = useMemo(() => {
|
||||
|
|
@ -920,6 +921,7 @@ const Configuration: FC = () => {
|
|||
setVisionConfig: handleSetVisionConfig,
|
||||
isAllowVideoUpload,
|
||||
isShowDocumentConfig,
|
||||
isShowAudioConfig,
|
||||
rerankSettingModalOpen,
|
||||
setRerankSettingModalOpen,
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -83,12 +83,11 @@ export const useChat = (
|
|||
const ret = [...threadMessages]
|
||||
if (config?.opening_statement) {
|
||||
const index = threadMessages.findIndex(item => item.isOpeningStatement)
|
||||
|
||||
if (index > -1) {
|
||||
ret[index] = {
|
||||
...ret[index],
|
||||
content: getIntroduction(config.opening_statement),
|
||||
suggestedQuestions: config.suggested_questions,
|
||||
suggestedQuestions: config.suggested_questions?.map(item => getIntroduction(item)),
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -97,7 +96,7 @@ export const useChat = (
|
|||
content: getIntroduction(config.opening_statement),
|
||||
isAnswer: true,
|
||||
isOpeningStatement: true,
|
||||
suggestedQuestions: config.suggested_questions,
|
||||
suggestedQuestions: config.suggested_questions?.map(item => getIntroduction(item)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ const OpeningSettingModal = ({
|
|||
<input
|
||||
type="input"
|
||||
value={question || ''}
|
||||
placeholder={t('appDebug.openingStatement.openingQuestionPlaceholder') as string}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value
|
||||
setTempSuggestedQuestions(tempSuggestedQuestions.map((item, i) => {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ export const useChat = (
|
|||
ret[index] = {
|
||||
...ret[index],
|
||||
content: getIntroduction(config.opening_statement),
|
||||
suggestedQuestions: config.suggested_questions,
|
||||
suggestedQuestions: config.suggested_questions?.map((item: string) => getIntroduction(item)),
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -101,7 +101,7 @@ export const useChat = (
|
|||
content: getIntroduction(config.opening_statement),
|
||||
isAnswer: true,
|
||||
isOpeningStatement: true,
|
||||
suggestedQuestions: config.suggested_questions,
|
||||
suggestedQuestions: config.suggested_questions?.map((item: string) => getIntroduction(item)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ type IDebugConfiguration = {
|
|||
setVisionConfig: (visionConfig: VisionSettings, noNotice?: boolean) => void
|
||||
isAllowVideoUpload: boolean
|
||||
isShowDocumentConfig: boolean
|
||||
isShowAudioConfig: boolean
|
||||
rerankSettingModalOpen: boolean
|
||||
setRerankSettingModalOpen: (rerankSettingModalOpen: boolean) => void
|
||||
}
|
||||
|
|
@ -254,6 +255,7 @@ const DebugConfigurationContext = createContext<IDebugConfiguration>({
|
|||
setVisionConfig: noop,
|
||||
isAllowVideoUpload: false,
|
||||
isShowDocumentConfig: false,
|
||||
isShowAudioConfig: false,
|
||||
rerankSettingModalOpen: false,
|
||||
setRerankSettingModalOpen: noop,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ const translation = {
|
|||
add: 'Hinzufügen',
|
||||
writeOpener: 'Eröffnung schreiben',
|
||||
placeholder: 'Schreiben Sie hier Ihre Eröffnungsnachricht, Sie können Variablen verwenden, versuchen Sie {{Variable}} zu tippen.',
|
||||
openingQuestionPlaceholder: 'Sie können Variablen verwenden, versuchen Sie {{variable}} einzugeben.',
|
||||
openingQuestion: 'Eröffnungsfragen',
|
||||
noDataPlaceHolder:
|
||||
'Den Dialog mit dem Benutzer zu beginnen, kann helfen, in konversationellen Anwendungen eine engere Verbindung mit ihnen herzustellen.',
|
||||
|
|
|
|||
|
|
@ -222,6 +222,10 @@ const translation = {
|
|||
title: 'Document',
|
||||
description: 'Enable Document will allows the model to take in documents and answer questions about them.',
|
||||
},
|
||||
audioUpload: {
|
||||
title: 'Audio',
|
||||
description: 'Enable Audio will allow the model to process audio files for transcription and analysis.',
|
||||
},
|
||||
},
|
||||
codegen: {
|
||||
title: 'Code Generator',
|
||||
|
|
@ -442,6 +446,7 @@ const translation = {
|
|||
writeOpener: 'Edit opener',
|
||||
placeholder: 'Write your opener message here, you can use variables, try type {{variable}}.',
|
||||
openingQuestion: 'Opening Questions',
|
||||
openingQuestionPlaceholder: 'You can use variables, try typing {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Starting the conversation with the user can help AI establish a closer connection with them in conversational applications.',
|
||||
varTip: 'You can use variables, try type {{variable}}',
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ const translation = {
|
|||
writeOpener: 'Escribir apertura',
|
||||
placeholder: 'Escribe tu mensaje de apertura aquí, puedes usar variables, intenta escribir {{variable}}.',
|
||||
openingQuestion: 'Preguntas de Apertura',
|
||||
openingQuestionPlaceholder: 'Puede usar variables, intente escribir {{variable}}.',
|
||||
noDataPlaceHolder: 'Iniciar la conversación con el usuario puede ayudar a la IA a establecer una conexión más cercana con ellos en aplicaciones de conversación.',
|
||||
varTip: 'Puedes usar variables, intenta escribir {{variable}}',
|
||||
tooShort: 'Se requieren al menos 20 palabras en la indicación inicial para generar una apertura de conversación.',
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ const translation = {
|
|||
writeOpener: 'نوشتن آغازگر',
|
||||
placeholder: 'پیام آغازگر خود را اینجا بنویسید، میتوانید از متغیرها استفاده کنید، سعی کنید {{variable}} را تایپ کنید.',
|
||||
openingQuestion: 'سوالات آغازین',
|
||||
openingQuestionPlaceholder: 'میتوانید از متغیرها استفاده کنید، سعی کنید {{variable}} را تایپ کنید.',
|
||||
noDataPlaceHolder: 'شروع مکالمه با کاربر میتواند به AI کمک کند تا ارتباط نزدیکتری با آنها برقرار کند.',
|
||||
varTip: 'میتوانید از متغیرها استفاده کنید، سعی کنید {{variable}} را تایپ کنید',
|
||||
tooShort: 'حداقل 20 کلمه از پرسش اولیه برای تولید نظرات آغازین مکالمه مورد نیاز است.',
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ const translation = {
|
|||
writeOpener: 'Écrire l\'introduction',
|
||||
placeholder: 'Rédigez votre message d\'ouverture ici, vous pouvez utiliser des variables, essayez de taper {{variable}}.',
|
||||
openingQuestion: 'Questions d\'ouverture',
|
||||
openingQuestionPlaceholder: 'Vous pouvez utiliser des variables, essayez de taper {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Commencer la conversation avec l\'utilisateur peut aider l\'IA à établir une connexion plus proche avec eux dans les applications conversationnelles.',
|
||||
varTip: 'Vous pouvez utiliser des variables, essayez de taper {{variable}}',
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ const translation = {
|
|||
placeholder:
|
||||
'यहां अपना प्रारंभक संदेश लिखें, आप वेरिएबल्स का उपयोग कर सकते हैं, {{variable}} टाइप करने का प्रयास करें।',
|
||||
openingQuestion: 'प्रारंभिक प्रश्न',
|
||||
openingQuestionPlaceholder: 'आप वेरिएबल्स का उपयोग कर सकते हैं, {{variable}} टाइप करके देखें।',
|
||||
noDataPlaceHolder:
|
||||
'उपयोगकर्ता के साथ संवाद प्रारंभ करने से एआई को संवादात्मक अनुप्रयोगों में उनके साथ निकट संबंध स्थापित करने में मदद मिल सकती है।',
|
||||
varTip:
|
||||
|
|
|
|||
|
|
@ -365,6 +365,7 @@ const translation = {
|
|||
placeholder:
|
||||
'Scrivi qui il tuo messaggio introduttivo, puoi usare variabili, prova a scrivere {{variable}}.',
|
||||
openingQuestion: 'Domande iniziali',
|
||||
openingQuestionPlaceholder: 'Puoi usare variabili, prova a digitare {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Iniziare la conversazione con l\'utente può aiutare l\'IA a stabilire un legame più stretto con loro nelle applicazioni conversazionali.',
|
||||
varTip: 'Puoi usare variabili, prova a scrivere {{variable}}',
|
||||
|
|
|
|||
|
|
@ -434,6 +434,7 @@ const translation = {
|
|||
writeOpener: 'オープナーを書く',
|
||||
placeholder: 'ここにオープナーメッセージを書いてください。変数を使用できます。{{variable}} を入力してみてください。',
|
||||
openingQuestion: '開始質問',
|
||||
openingQuestionPlaceholder: '変数を使用できます。{{variable}} と入力してみてください。',
|
||||
noDataPlaceHolder:
|
||||
'ユーザーとの会話を開始すると、会話アプリケーションで彼らとのより密接な関係を築くのに役立ちます。',
|
||||
varTip: '変数を使用できます。{{variable}} を入力してみてください',
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ const translation = {
|
|||
writeOpener: '오프너 작성',
|
||||
placeholder: '여기에 오프너 메시지를 작성하세요. 변수를 사용할 수 있습니다. {{variable}}를 입력해보세요.',
|
||||
openingQuestion: '시작 질문',
|
||||
openingQuestionPlaceholder: '변수를 사용할 수 있습니다. {{variable}}을(를) 입력해 보세요.',
|
||||
noDataPlaceHolder: '사용자와의 대화를 시작하면 대화 애플리케이션에서 그들과 더 밀접한 관계를 구축하는 데 도움이 됩니다.',
|
||||
varTip: '변수를 사용할 수 있습니다. {{variable}}를 입력해보세요.',
|
||||
tooShort: '대화 시작에는 최소 20 단어의 초기 프롬프트가 필요합니다.',
|
||||
|
|
|
|||
|
|
@ -360,6 +360,7 @@ const translation = {
|
|||
placeholder:
|
||||
'Tutaj napisz swoją wiadomość wprowadzającą, możesz użyć zmiennych, spróbuj wpisać {{variable}}.',
|
||||
openingQuestion: 'Pytania otwierające',
|
||||
openingQuestionPlaceholder: 'Możesz używać zmiennych, spróbuj wpisać {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Rozpoczynanie rozmowy z użytkownikiem może pomóc AI nawiązać bliższe połączenie z nim w aplikacjach konwersacyjnych.',
|
||||
varTip: 'Możesz używać zmiennych, spróbuj wpisać {{variable}}',
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ const translation = {
|
|||
writeOpener: 'Escrever abertura',
|
||||
placeholder: 'Escreva sua mensagem de abertura aqui, você pode usar variáveis, tente digitar {{variável}}.',
|
||||
openingQuestion: 'Perguntas de Abertura',
|
||||
openingQuestionPlaceholder: 'Você pode usar variáveis, tente digitar {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Iniciar a conversa com o usuário pode ajudar a IA a estabelecer uma conexão mais próxima com eles em aplicativos de conversação.',
|
||||
varTip: 'Você pode usar variáveis, tente digitar {{variável}}',
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ const translation = {
|
|||
writeOpener: 'Написать начальное сообщение',
|
||||
placeholder: 'Напишите здесь свое начальное сообщение, вы можете использовать переменные, попробуйте ввести {{variable}}.',
|
||||
openingQuestion: 'Начальные вопросы',
|
||||
openingQuestionPlaceholder: 'Вы можете использовать переменные, попробуйте ввести {{variable}}.',
|
||||
noDataPlaceHolder:
|
||||
'Начало разговора с пользователем может помочь ИИ установить более тесную связь с ним в диалоговых приложениях.',
|
||||
varTip: 'Вы можете использовать переменные, попробуйте ввести {{variable}}',
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ const translation = {
|
|||
writeOpener: 'Başlangıç mesajı yaz',
|
||||
placeholder: 'Başlangıç mesajınızı buraya yazın, değişkenler kullanabilirsiniz, örneğin {{variable}} yazmayı deneyin.',
|
||||
openingQuestion: 'Açılış Soruları',
|
||||
openingQuestionPlaceholder: 'Değişkenler kullanabilirsiniz, {{variable}} yazmayı deneyin.',
|
||||
noDataPlaceHolder:
|
||||
'Kullanıcı ile konuşmayı başlatmak, AI\'ın konuşma uygulamalarında onlarla daha yakın bir bağlantı kurmasına yardımcı olabilir.',
|
||||
varTip: 'Değişkenler kullanabilirsiniz, örneğin {{variable}} yazmayı deneyin',
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ const translation = {
|
|||
writeOpener: 'Напишіть вступне повідомлення', // Write opener
|
||||
placeholder: 'Напишіть тут своє вступне повідомлення, ви можете використовувати змінні, спробуйте ввести {{variable}}.', // Write your opener message here...
|
||||
openingQuestion: 'Відкриваючі питання', // Opening Questions
|
||||
openingQuestionPlaceholder: 'Ви можете використовувати змінні, спробуйте ввести {{variable}}.',
|
||||
noDataPlaceHolder: 'Початок розмови з користувачем може допомогти ШІ встановити більш тісний зв’язок з ним у розмовних застосунках.', // ... conversational applications.
|
||||
varTip: 'Ви можете використовувати змінні, спробуйте ввести {{variable}}', // You can use variables, try type {{variable}}
|
||||
tooShort: 'Для створення вступних зауважень для розмови потрібно принаймні 20 слів вступного запиту.', // ... are required to generate an opening remarks for the conversation.
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ const translation = {
|
|||
writeOpener: 'Viết câu mở đầu',
|
||||
placeholder: 'Viết thông điệp mở đầu của bạn ở đây, bạn có thể sử dụng biến, hãy thử nhập {{biến}}.',
|
||||
openingQuestion: 'Câu hỏi mở đầu',
|
||||
openingQuestionPlaceholder: 'Bạn có thể sử dụng biến, hãy thử nhập {{variable}}.',
|
||||
noDataPlaceHolder: 'Bắt đầu cuộc trò chuyện với người dùng có thể giúp AI thiết lập mối quan hệ gần gũi hơn với họ trong các ứng dụng trò chuyện.',
|
||||
varTip: 'Bạn có thể sử dụng biến, hãy thử nhập {{biến}}',
|
||||
tooShort: 'Cần ít nhất 20 từ trong lời nhắc ban đầu để tạo ra các câu mở đầu cho cuộc trò chuyện.',
|
||||
|
|
|
|||
|
|
@ -436,6 +436,7 @@ const translation = {
|
|||
writeOpener: '编写开场白',
|
||||
placeholder: '在这里写下你的开场白,你可以使用变量,尝试输入 {{variable}}。',
|
||||
openingQuestion: '开场问题',
|
||||
openingQuestionPlaceholder: '可以使用变量,尝试输入 {{variable}}。',
|
||||
noDataPlaceHolder:
|
||||
'在对话型应用中,让 AI 主动说第一段话可以拉近与用户间的距离。',
|
||||
varTip: '你可以使用变量,试试输入 {{variable}}',
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ const translation = {
|
|||
writeOpener: '編寫開場白',
|
||||
placeholder: '在這裡寫下你的開場白,你可以使用變數,嘗試輸入 {{variable}}。',
|
||||
openingQuestion: '開場問題',
|
||||
openingQuestionPlaceholder: '可以使用變量,嘗試輸入 {{variable}}。',
|
||||
noDataPlaceHolder:
|
||||
'在對話型應用中,讓 AI 主動說第一段話可以拉近與使用者間的距離。',
|
||||
varTip: '你可以使用變數,試試輸入 {{variable}}',
|
||||
|
|
|
|||
Loading…
Reference in New Issue