Skip to content

Commit

Permalink
Merge branch 'langgenius:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
leslie2046 authored Apr 25, 2024
2 parents e2a2162 + 3d14aba commit c716a26
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Dify is an open-source LLM app development platform. Its intuitive interface com


**2. Comprehensive model support**:
Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama2, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).
Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama3, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).

![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)

Expand Down
2 changes: 1 addition & 1 deletion README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Dify es una plataforma de desarrollo de aplicaciones de LLM de código abierto.


**2. Soporte de modelos completo**:
Integración perfecta con cientos de LLMs propietarios / de código abierto de docenas de proveedores de inferencia y soluciones auto-alojadas, que cubren GPT, Mistral, Llama2 y cualquier modelo compatible con la API de OpenAI. Se puede encontrar una lista completa de proveedores de modelos admitidos [aquí](https://docs.dify.ai/getting-started/readme/model-providers).
Integración perfecta con cientos de LLMs propietarios / de código abierto de docenas de proveedores de inferencia y soluciones auto-alojadas, que cubren GPT, Mistral, Llama3 y cualquier modelo compatible con la API de OpenAI. Se puede encontrar una lista completa de proveedores de modelos admitidos [aquí](https://docs.dify.ai/getting-started/readme/model-providers).

![proveedores-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)

Expand Down
2 changes: 1 addition & 1 deletion README_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Dify est une plateforme de développement d'applications LLM open source. Son in


**2. Prise en charge complète des modèles**:
Intégration transparente avec des centaines de LLM propriétaires / open source provenant de dizaines de fournisseurs d'inférence et de solutions auto-hébergées, couvrant GPT, Mistral, Llama2, et tous les modèles compatibles avec l'API OpenAI. Une liste complète des fournisseurs de modèles pris en charge se trouve [ici](https://docs.dify.ai/getting-started/readme/model-providers).
Intégration transparente avec des centaines de LLM propriétaires / open source provenant de dizaines de fournisseurs d'inférence et de solutions auto-hébergées, couvrant GPT, Mistral, Llama3, et tous les modèles compatibles avec l'API OpenAI. Une liste complète des fournisseurs de modèles pris en charge se trouve [ici](https://docs.dify.ai/getting-started/readme/model-providers).

![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)

Expand Down
2 changes: 1 addition & 1 deletion README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DifyはオープンソースのLLMアプリケーション開発プラットフ


**2. 網羅的なモデルサポート**:
数百のプロプライエタリ/オープンソースのLLMと、数十の推論プロバイダーおよびセルフホスティングソリューションとのシームレスな統合を提供します。GPT、Mistral、Llama2、およびOpenAI API互換のモデルをカバーします。サポートされているモデルプロバイダーの完全なリストは[こちら](https://docs.dify.ai/getting-started/readme/model-providers)をご覧ください。
数百のプロプライエタリ/オープンソースのLLMと、数十の推論プロバイダーおよびセルフホスティングソリューションとのシームレスな統合を提供します。GPT、Mistral、Llama3、およびOpenAI API互換のモデルをカバーします。サポートされているモデルプロバイダーの完全なリストは[こちら](https://docs.dify.ai/getting-started/readme/model-providers)をご覧ください。

![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)

Expand Down
2 changes: 1 addition & 1 deletion README_KL.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Dify is an open-source LLM app development platform. Its intuitive interface com


**2. Comprehensive model support**:
Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama2, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).
Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama3, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).

![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)

Expand Down
2 changes: 1 addition & 1 deletion api/core/model_runtime/model_providers/groq/groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def validate_provider_credentials(self, credentials: dict) -> None:
model_instance = self.get_model_instance(ModelType.LLM)

model_instance.validate_credentials(
model='llama2-70b-4096',
model='llama3-8b-8192',
credentials=credentials
)
except CredentialsValidateFailedError as ex:
Expand Down
3 changes: 2 additions & 1 deletion api/core/rag/datasource/vdb/qdrant/qdrant_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def to_qdrant_params(self):
return {
'url': self.endpoint,
'api_key': self.api_key,
'timeout': self.timeout
'timeout': self.timeout,
'verify': self.endpoint.startswith('https')
}


Expand Down
23 changes: 15 additions & 8 deletions api/core/tools/provider/builtin/bing/tools/bing_web_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,31 @@ def _invoke_bing(self,
results = []
if search_results:
for result in search_results:
url = f': {result["url"]}' if "url" in result else ""
results.append(self.create_text_message(
text=f'{result["name"]}: {result["url"]}'
text=f'{result["name"]}{url}'
))


if entities:
for entity in entities:
url = f': {entity["url"]}' if "url" in entity else ""
results.append(self.create_text_message(
text=f'{entity["name"]}: {entity["url"]}'
text=f'{entity.get("name", "")}{url}'
))

if news:
for news_item in news:
url = f': {news_item["url"]}' if "url" in news_item else ""
results.append(self.create_text_message(
text=f'{news_item["name"]}: {news_item["url"]}'
text=f'{news_item.get("name", "")}{url}'
))

if related_searches:
for related in related_searches:
url = f': {related["displayText"]}' if "displayText" in related else ""
results.append(self.create_text_message(
text=f'{related["displayText"]}: {related["webSearchUrl"]}'
text=f'{related.get("displayText", "")}{url}'
))

return results
Expand All @@ -73,7 +77,7 @@ def _invoke_bing(self,
text = ''
if search_results:
for i, result in enumerate(search_results):
text += f'{i+1}: {result["name"]} - {result["snippet"]}\n'
text += f'{i+1}: {result.get("name", "")} - {result.get("snippet", "")}\n'

if computation and 'expression' in computation and 'value' in computation:
text += '\nComputation:\n'
Expand All @@ -82,17 +86,20 @@ def _invoke_bing(self,
if entities:
text += '\nEntities:\n'
for entity in entities:
text += f'{entity["name"]} - {entity["url"]}\n'
url = f'- {entity["url"]}' if "url" in entity else ""
text += f'{entity.get("name", "")}{url}\n'

if news:
text += '\nNews:\n'
for news_item in news:
text += f'{news_item["name"]} - {news_item["url"]}\n'
url = f'- {news_item["url"]}' if "url" in news_item else ""
text += f'{news_item.get("name", "")}{url}\n'

if related_searches:
text += '\n\nRelated Searches:\n'
for related in related_searches:
text += f'{related["displayText"]} - {related["webSearchUrl"]}\n'
url = f'- {related["webSearchUrl"]}' if "webSearchUrl" in related else ""
text += f'{related.get("displayText", "")}{url}\n'

return self.create_text_message(text=self.summary(user_id=user_id, content=text))

Expand Down
1 change: 0 additions & 1 deletion web/app/components/base/tag-management/selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ const TagSelector: FC<TagSelectorProps> = ({
<div className='grow text-xs text-start leading-[18px] font-normal truncate'>
{!triggerContent ? t('common.tag.addTag') : triggerContent}
</div>
<span className='hidden absolute top-[-21px] left-[50%] translate-x-[-50%] px-2 py-[3px] border-[0.5px] border-black/5 rounded-md bg-gray-25 text-gray-700 text-xs font-medium leading-[18px] group-hover/tip:block'>{t('common.tag.editTag')}</span>
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,6 @@ const QuotaPanel: FC<QuotaPanelProps> = ({
</div>
)
}
{
!currentQuota && provider.provider === 'anthropic' && (
<Button
className='h-6 bg-white text-xs font-medium rounded-md'
onClick={handlePay}
>
{t('common.modelProvider.buyQuota')}
</Button>
)
}
{
!currentQuota && MODEL_PROVIDER_QUOTA_GET_FREE.includes(provider.provider) && (
<Button
Expand All @@ -88,20 +78,6 @@ const QuotaPanel: FC<QuotaPanelProps> = ({
</Button>
)
}
{
provider.provider === 'anthropic' && systemConfig.enabled && (
<div
className={`
absolute left-0 bottom-0 hidden group-hover:flex items-center justify-center
w-full h-[30px] backdrop-blur-[2px] bg-gradient-to-r from-[rgba(238,244,255,0.80)] to-[rgba(237,237,240,0.70)]
text-xs font-medium text-primary-600 cursor-pointer rounded-b-lg
`}
onClick={handlePay}
>
{t('common.modelProvider.buyQuota')}
</div>
)
}
{
priorityUseType === PreferredProviderTypeEnum.system && customConfig.status === CustomConfigurationStatusEnum.active && (
<PriorityUseTip />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import ModelBadge from '../model-badge'
import ProviderIcon from '../provider-icon'
import s from './index.module.css'
import { Plus, Settings01 } from '@/app/components/base/icons/src/vender/line/general'
import { CoinsStacked01 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce'
import Button from '@/app/components/base/button'
import { IS_CE_EDITION } from '@/config'

Expand Down Expand Up @@ -136,17 +135,6 @@ const ProviderCard: FC<ProviderCardProps> = ({
)
})
}
{
provider.provider === 'anthropic' && !IS_CE_EDITION && (
<Button
className='h-7 text-xs text-gray-700'
onClick={handlePay}
>
<CoinsStacked01 className='mr-[5px] w-3.5 h-3.5' />
{t('common.modelProvider.buyQuota')}
</Button>
)
}
</div>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions web/app/components/share/text-generation/run-once/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const RunOnce: FC<IRunOnceProps> = ({
placeholder={`${item.name}${!item.required ? `(${t('appDebug.variableTable.optional')})` : ''}`}
value={inputs[item.key]}
onChange={(e) => { onInputsChange({ ...inputs, [item.key]: e.target.value }) }}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()
onSend()
}
}}
maxLength={item.max_length || DEFAULT_VALUE_MAX_LEN}
/>
)}
Expand Down
62 changes: 39 additions & 23 deletions web/app/components/workflow/hooks/use-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {
useCallback,
useEffect,
useMemo,
useState,
} from 'react'
import dayjs from 'dayjs'
import { uniqBy } from 'lodash-es'
import { useContext } from 'use-context-selector'
import useSWR from 'swr'
import produce from 'immer'
import {
getIncomers,
Expand Down Expand Up @@ -52,6 +52,7 @@ import {
fetchWorkflowDraft,
syncWorkflowDraft,
} from '@/service/workflow'
import type { FetchWorkflowDraftResponse } from '@/types/workflow'
import {
fetchAllBuiltInTools,
fetchAllCustomTools,
Expand Down Expand Up @@ -403,9 +404,45 @@ export const useWorkflowInit = () => {
} = useWorkflowTemplate()
const { handleFetchAllTools } = useFetchToolsData()
const appDetail = useAppStore(state => state.appDetail)!
const { data, isLoading, error, mutate } = useSWR(`/apps/${appDetail.id}/workflows/draft`, fetchWorkflowDraft)
const [data, setData] = useState<FetchWorkflowDraftResponse>()
const [isLoading, setIsLoading] = useState(true)
workflowStore.setState({ appId: appDetail.id })

const handleGetInitialWorkflowData = useCallback(async () => {
try {
const res = await fetchWorkflowDraft(`/apps/${appDetail.id}/workflows/draft`)

setData(res)
setIsLoading(false)
}
catch (error: any) {
if (error && error.json && !error.bodyUsed && appDetail) {
error.json().then((err: any) => {
if (err.code === 'draft_workflow_not_exist') {
workflowStore.setState({ notInitialWorkflow: true })
syncWorkflowDraft({
url: `/apps/${appDetail.id}/workflows/draft`,
params: {
graph: {
nodes: nodesTemplate,
edges: edgesTemplate,
},
features: {},
},
}).then((res) => {
workflowStore.getState().setDraftUpdatedAt(res.updated_at)
handleGetInitialWorkflowData()
})
}
})
}
}
}, [appDetail, nodesTemplate, edgesTemplate, workflowStore])

useEffect(() => {
handleGetInitialWorkflowData()
}, [])

const handleFetchPreloadData = useCallback(async () => {
try {
const nodesDefaultConfigsData = await fetchNodesDefaultConfigs(`/apps/${appDetail?.id}/workflows/default-workflow-block-configs`)
Expand Down Expand Up @@ -435,27 +472,6 @@ export const useWorkflowInit = () => {
workflowStore.getState().setDraftUpdatedAt(data.updated_at)
}, [data, workflowStore])

if (error && error.json && !error.bodyUsed && appDetail) {
error.json().then((err: any) => {
if (err.code === 'draft_workflow_not_exist') {
workflowStore.setState({ notInitialWorkflow: true })
syncWorkflowDraft({
url: `/apps/${appDetail.id}/workflows/draft`,
params: {
graph: {
nodes: nodesTemplate,
edges: edgesTemplate,
},
features: {},
},
}).then((res) => {
workflowStore.getState().setDraftUpdatedAt(res.updated_at)
mutate()
})
}
})
}

return {
data,
isLoading,
Expand Down
17 changes: 0 additions & 17 deletions web/app/components/workflow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import ReactFlow, {
useEdgesState,
useNodesState,
useOnViewportChange,
useReactFlow,
} from 'reactflow'
import type { Viewport } from 'reactflow'
import 'reactflow/dist/style.css'
Expand Down Expand Up @@ -72,7 +71,6 @@ const Workflow: FC<WorkflowProps> = memo(({
edges: originalEdges,
viewport,
}) => {
const reactflow = useReactFlow()
const [nodes, setNodes] = useNodesState(originalNodes)
const [edges, setEdges] = useEdgesState(originalEdges)
const showFeaturesPanel = useStore(state => state.showFeaturesPanel)
Expand All @@ -93,17 +91,6 @@ const Workflow: FC<WorkflowProps> = memo(({
}
})

useEffect(() => {
setNodes(originalNodes)
}, [originalNodes, setNodes])
useEffect(() => {
setEdges(originalEdges)
}, [originalEdges, setEdges])
useEffect(() => {
if (viewport)
reactflow.setViewport(viewport)
}, [reactflow, viewport])

useEffect(() => {
setAutoFreeze(false)

Expand Down Expand Up @@ -155,8 +142,6 @@ const Workflow: FC<WorkflowProps> = memo(({
} = useEdgesInteractions()
const {
isValidConnection,
enableShortcuts,
disableShortcuts,
} = useWorkflow()

useOnViewportChange({
Expand Down Expand Up @@ -193,8 +178,6 @@ const Workflow: FC<WorkflowProps> = memo(({
edgeTypes={edgeTypes}
nodes={nodes}
edges={edges}
onPointerDown={enableShortcuts}
onMouseLeave={disableShortcuts}
onNodeDragStart={handleNodeDragStart}
onNodeDrag={handleNodeDrag}
onNodeDragStop={handleNodeDragStop}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ const Base: FC<Props> = ({
<div ref={ref} className={cn(className, isExpand && 'h-full', 'rounded-lg border', isFocus ? 'bg-white border-gray-200' : 'bg-gray-100 border-gray-100 overflow-hidden')}>
<div className='flex justify-between items-center h-7 pt-1 pl-3 pr-2'>
<div className='text-xs font-semibold text-gray-700'>{title}</div>
<div className='flex items-center' onClick={e => e.stopPropagation()}>
<div className='flex items-center' onClick={(e) => {
e.nativeEvent.stopImmediatePropagation()
e.stopPropagation()
}}>
{headerRight}
{!isCopied
? (
Expand Down
Loading

0 comments on commit c716a26

Please sign in to comment.