Skip to content

Commit

Permalink
Merge branch 'feat/new-studio' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
douxc committed Dec 6, 2024
2 parents 5a91484 + 42b8138 commit 83a1efc
Show file tree
Hide file tree
Showing 67 changed files with 521 additions and 140 deletions.
13 changes: 3 additions & 10 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@ Please include a summary of the change and which issue is fixed. Please also inc

# Screenshots

<table>
<tr>
<td>Before: </td>
<td>After: </td>
</tr>
<tr>
<td>...</td>
<td>...</td>
</tr>
</table>
| Before | After |
|--------|-------|
| ... | ... |

# Checklist

Expand Down
2 changes: 1 addition & 1 deletion api/configs/packaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PackagingInfo(BaseSettings):

CURRENT_VERSION: str = Field(
description="Dify version",
default="0.13.0",
default="0.13.1",
)

COMMIT_SHA: str = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ features:
- agent-thought
- tool-call
- stream-tool-call
- vision
model_properties:
mode: chat
context_size: 300000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ features:
- agent-thought
- tool-call
- stream-tool-call
- vision
model_properties:
mode: chat
context_size: 300000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ features:
- agent-thought
- tool-call
- stream-tool-call
- vision
model_properties:
mode: chat
context_size: 300000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ features:
- agent-thought
- tool-call
- stream-tool-call
- vision
model_properties:
mode: chat
context_size: 300000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- rerank-english-v3.0
- rerank-multilingual-v2.0
- rerank-multilingual-v3.0
- rerank-v3.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
model: rerank-v3.5
model_type: rerank
model_properties:
context_size: 5120
4 changes: 2 additions & 2 deletions api/tasks/external_document_indexing_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import click
from celery import shared_task

from core.indexing_runner import DocumentIsPausedException
from core.indexing_runner import DocumentIsPausedError
from extensions.ext_database import db
from extensions.ext_storage import storage
from models.dataset import Dataset, ExternalKnowledgeApis
Expand Down Expand Up @@ -86,7 +86,7 @@ def external_document_indexing_task(
fg="green",
)
)
except DocumentIsPausedException as ex:
except DocumentIsPausedError as ex:
logging.info(click.style(str(ex), fg="yellow"))

except Exception:
Expand Down
6 changes: 3 additions & 3 deletions docker-legacy/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
# API service
api:
image: langgenius/dify-api:0.13.0
image: langgenius/dify-api:0.13.1
restart: always
environment:
# Startup mode, 'api' starts the API server.
Expand Down Expand Up @@ -227,7 +227,7 @@ services:
# worker service
# The Celery worker for processing the queue.
worker:
image: langgenius/dify-api:0.13.0
image: langgenius/dify-api:0.13.1
restart: always
environment:
CONSOLE_WEB_URL: ''
Expand Down Expand Up @@ -397,7 +397,7 @@ services:

# Frontend web application.
web:
image: langgenius/dify-web:0.13.0
image: langgenius/dify-web:0.13.1
restart: always
environment:
# The base URL of console application api server, refers to the Console base URL of WEB service if console domain is
Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ x-shared-env: &shared-api-worker-env
services:
# API service
api:
image: langgenius/dify-api:0.13.0
image: langgenius/dify-api:0.13.1
restart: always
environment:
# Use the shared environment variables.
Expand All @@ -312,7 +312,7 @@ services:
# worker service
# The Celery worker for processing the queue.
worker:
image: langgenius/dify-api:0.13.0
image: langgenius/dify-api:0.13.1
restart: always
environment:
# Use the shared environment variables.
Expand All @@ -331,7 +331,7 @@ services:

# Frontend web application.
web:
image: langgenius/dify-web:0.13.0
image: langgenius/dify-web:0.13.1
restart: always
environment:
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const ExtraInfo = ({ isMobile, relatedApps }: IExtraInfoProps) => {
className='inline-flex items-center text-xs text-primary-600 mt-2 cursor-pointer'
href={
locale === LanguagesSupported[1]
? 'https://docs.dify.ai/v/zh-hans/guides/knowledge-base/integrate_knowledge_within_application'
? 'https://docs.dify.ai/v/zh-hans/guides/knowledge-base/integrate-knowledge-within-application'
: 'https://docs.dify.ai/guides/knowledge-base/integrate-knowledge-within-application'
}
target='_blank' rel='noopener noreferrer'
Expand Down
11 changes: 6 additions & 5 deletions web/app/components/app/create-app-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,20 @@ function AppPreview({ mode }: { mode: AppMode }) {
}

function AppScreenShot({ mode }: { mode: AppMode }) {
const theme = useContextSelector(AppsContext, state => state.theme)
const modeToImageMap = {
'chat': 'Chatbot',
'advanced-chat': 'ChatFlow',
'advanced-chat': 'Chatflow',
'agent-chat': 'Agent',
'completion': 'TextGenerator',
'workflow': 'Workflow',
}
return <picture>
<source media="(resolution: 1x)" srcSet={`/screenshots/Light/${modeToImageMap[mode]}.png`} />
<source media="(resolution: 2x)" srcSet={`/screenshots/Light/${modeToImageMap[mode]}@2x.png`} />
<source media="(resolution: 3x)" srcSet={`/screenshots/Light/${modeToImageMap[mode]}@3x.png`} />
<source media="(resolution: 1x)" srcSet={`/screenshots/${theme}/${modeToImageMap[mode]}.png`} />
<source media="(resolution: 2x)" srcSet={`/screenshots/${theme}/${modeToImageMap[mode]}@2x.png`} />
<source media="(resolution: 3x)" srcSet={`/screenshots/${theme}/${modeToImageMap[mode]}@3x.png`} />
<Image
src={`/screenshots/Light/${modeToImageMap[mode]}.png`}
src={`/screenshots/${theme}/${modeToImageMap[mode]}.png`}
alt='App Screen Shot'
width={664} height={448} />
</picture>
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/base/fullscreen-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function FullScreenModal({
className,
)}>
{closable
&& <div className='absolute z-50 top-3 right-3 w-9 h-9 flex items-center justify-center rounded-xl bg-components-button-tertiary-bg cursor-pointer'>
&& <div className='absolute z-50 top-3 right-3 w-9 h-9 flex items-center justify-center rounded-[10px] bg-components-button-tertiary-bg cursor-pointer'>
<RiCloseLargeLine className='w-4 h-4 text-components-button-tertiary-text' onClick={
(e) => {
e.stopPropagation()
Expand Down
94 changes: 70 additions & 24 deletions web/app/components/base/mermaid/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import React, { useEffect, useRef, useState } from 'react'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import mermaid from 'mermaid'
import { usePrevious } from 'ahooks'
import CryptoJS from 'crypto-js'
import { useTranslation } from 'react-i18next'
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'
import LoadingAnim from '@/app/components/base/chat/chat/loading-anim'
import cn from '@/utils/classnames'
import ImagePreview from '@/app/components/base/image-uploader/image-preview'

let mermaidAPI: any
mermaidAPI = null

if (typeof window !== 'undefined') {
mermaid.initialize({
startOnLoad: true,
theme: 'default',
flowchart: {
htmlLabels: true,
useMaxWidth: true,
},
})
if (typeof window !== 'undefined')
mermaidAPI = mermaid.mermaidAPI
}

const style = {
minWidth: '480px',
Expand All @@ -40,14 +34,21 @@ const svgToBase64 = (svgGraph: string) => {
const Flowchart = React.forwardRef((props: {
PrimitiveCode: string
}, ref) => {
const { t } = useTranslation()
const [svgCode, setSvgCode] = useState(null)
const [look, setLook] = useState<'classic' | 'handDrawn'>('classic')

const chartId = useRef(`flowchart_${CryptoJS.MD5(props.PrimitiveCode).toString()}`)
const prevPrimitiveCode = usePrevious(props.PrimitiveCode)
const [isLoading, setIsLoading] = useState(true)
const timeRef = useRef<NodeJS.Timeout>()
const [errMsg, setErrMsg] = useState('')
const [imagePreviewUrl, setImagePreviewUrl] = useState('')

const renderFlowchart = useCallback(async (PrimitiveCode: string) => {
setSvgCode(null)
setIsLoading(true)

const renderFlowchart = async (PrimitiveCode: string) => {
try {
if (typeof window !== 'undefined' && mermaidAPI) {
const svgGraph = await mermaidAPI.render(chartId.current, PrimitiveCode)
Expand All @@ -64,10 +65,28 @@ const Flowchart = React.forwardRef((props: {
setErrMsg((error as Error).message)
}
}
}
}, [props.PrimitiveCode])

useEffect(() => {
if (typeof window !== 'undefined') {
mermaid.initialize({
startOnLoad: true,
theme: 'neutral',
look,
flowchart: {
htmlLabels: true,
useMaxWidth: true,
},
})

localStorage.removeItem(chartId.current)
renderFlowchart(props.PrimitiveCode)
}
}, [look])

useEffect(() => {
const cachedSvg: any = localStorage.getItem(chartId.current)

if (cachedSvg) {
setSvgCode(cachedSvg)
setIsLoading(false)
Expand All @@ -85,24 +104,51 @@ const Flowchart = React.forwardRef((props: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
<div ref={ref}>
<div className="msh-segmented msh-segmented-sm css-23bs09 css-var-r1">
<div className="msh-segmented-group">
<label className="msh-segmented-item flex items-center space-x-1 m-2 w-[200px]">
<div key='classic'
className={cn('flex items-center justify-center mb-4 w-[calc((100%-8px)/2)] h-8 rounded-lg border border-components-option-card-option-border bg-components-option-card-option-bg cursor-pointer system-sm-medium text-text-secondary',
look === 'classic' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary',
)}

onClick={() => setLook('classic')}
>
<div className="msh-segmented-item-label">{t('app.mermaid.classic')}</div>
</div>
<div key='handDrawn'
className={cn(
'flex items-center justify-center mb-4 w-[calc((100%-8px)/2)] h-8 rounded-lg border border-components-option-card-option-border bg-components-option-card-option-bg cursor-pointer system-sm-medium text-text-secondary',
look === 'handDrawn' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary',
)}
onClick={() => setLook('handDrawn')}
>
<div className="msh-segmented-item-label">{t('app.mermaid.handDrawn')}</div>
</div>
</label>
</div>
</div>
{
svgCode
&& <div className="mermaid" style={style}>
{svgCode && <img src={svgCode} style={{ width: '100%', height: 'auto' }} alt="Mermaid chart" />}
</div>
&& <div className="mermaid cursor-pointer" style={style} onClick={() => setImagePreviewUrl(svgCode)}>
{svgCode && <img src={svgCode} style={{ width: '100%', height: 'auto' }} alt="mermaid_chart" />}
</div>
}
{isLoading
&& <div className='py-4 px-[26px]'>
<LoadingAnim type='text' />
</div>
&& <div className='py-4 px-[26px]'>
<LoadingAnim type='text'/>
</div>
}
{
errMsg
&& <div className='py-4 px-[26px]'>
<ExclamationTriangleIcon className='w-6 h-6 text-red-500' />
&nbsp;
{errMsg}
</div>
&& <div className='py-4 px-[26px]'>
<ExclamationTriangleIcon className='w-6 h-6 text-red-500'/>
&nbsp;
{errMsg}
</div>
}
{
imagePreviewUrl && (<ImagePreview title='mermaid_chart' url={imagePreviewUrl} onCancel={() => setImagePreviewUrl('')} />)
}
</div>
)
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/de-DE/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const translation = {
runDetail: {
title: 'Konversationsprotokoll',
workflowTitle: 'Protokolldetail',
fileListLabel: 'Details zur Datei',
fileListDetail: 'Detail',
},
promptLog: 'Prompt-Protokoll',
agentLog: 'Agentenprotokoll',
Expand Down
4 changes: 4 additions & 0 deletions web/i18n/en-US/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const translation = {
advanced: 'Chatflow',
},
duplicate: 'Duplicate',
mermaid: {
handDrawn: 'Hand Drawn',
classic: 'Classic',
},
duplicateTitle: 'Duplicate App',
export: 'Export DSL',
exportFailed: 'Export DSL failed.',
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/es-ES/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const translation = {
runDetail: {
title: 'Registro de Conversación',
workflowTitle: 'Detalle del Registro',
fileListLabel: 'Detalles del archivo',
fileListDetail: 'Detalle',
},
promptLog: 'Registro de Indicación',
agentLog: 'Registro de Agente',
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/fa-IR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const translation = {
runDetail: {
title: 'لاگ مکالمه',
workflowTitle: 'جزئیات لاگ',
fileListLabel: 'جزئیات فایل',
fileListDetail: 'جزئیات',
},
promptLog: 'لاگ درخواست',
agentLog: 'لاگ عامل',
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/fr-FR/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const translation = {
runDetail: {
title: 'Journal de conversation',
workflowTitle: 'Détail du journal',
fileListDetail: 'Détail',
fileListLabel: 'Détails du fichier',
},
promptLog: 'Journal de consigne',
agentLog: 'Journal des agents',
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/hi-IN/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const translation = {
runDetail: {
title: 'बातचीत लॉग',
workflowTitle: 'लॉग विवरण',
fileListDetail: 'विस्तार',
fileListLabel: 'फ़ाइल विवरण',
},
promptLog: 'प्रॉम्प्ट लॉग',
agentLog: 'एजेंट लॉग',
Expand Down
2 changes: 2 additions & 0 deletions web/i18n/it-IT/app-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ const translation = {
runDetail: {
title: 'Registro Conversazione',
workflowTitle: 'Dettagli Registro',
fileListDetail: 'Dettaglio',
fileListLabel: 'Dettagli del file',
},
promptLog: 'Registro Prompt',
agentLog: 'Registro Agente',
Expand Down
Loading

0 comments on commit 83a1efc

Please sign in to comment.