Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/chatting-message…
Browse files Browse the repository at this point in the history
…-switch-navigation
  • Loading branch information
xuzuodong committed Dec 10, 2024
2 parents f34cd75 + 32f8439 commit 9ba6005
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 36 deletions.
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.1",
default="0.13.2",
)

COMMIT_SHA: str = Field(
Expand Down
1 change: 1 addition & 0 deletions api/core/model_runtime/model_providers/minimax/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
class MinimaxLargeLanguageModel(LargeLanguageModel):
model_apis = {
"abab7-chat-preview": MinimaxChatCompletionPro,
"abab6.5t-chat": MinimaxChatCompletionPro,
"abab6.5s-chat": MinimaxChatCompletionPro,
"abab6.5-chat": MinimaxChatCompletionPro,
"abab6-chat": MinimaxChatCompletionPro,
Expand Down
17 changes: 9 additions & 8 deletions api/core/workflow/graph_engine/entities/event.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections.abc import Mapping
from datetime import datetime
from typing import Any, Optional

Expand Down Expand Up @@ -140,8 +141,8 @@ class BaseIterationEvent(GraphEngineEvent):

class IterationRunStartedEvent(BaseIterationEvent):
start_at: datetime = Field(..., description="start at")
inputs: Optional[dict[str, Any]] = None
metadata: Optional[dict[str, Any]] = None
inputs: Optional[Mapping[str, Any]] = None
metadata: Optional[Mapping[str, Any]] = None
predecessor_node_id: Optional[str] = None


Expand All @@ -153,18 +154,18 @@ class IterationRunNextEvent(BaseIterationEvent):

class IterationRunSucceededEvent(BaseIterationEvent):
start_at: datetime = Field(..., description="start at")
inputs: Optional[dict[str, Any]] = None
outputs: Optional[dict[str, Any]] = None
metadata: Optional[dict[str, Any]] = None
inputs: Optional[Mapping[str, Any]] = None
outputs: Optional[Mapping[str, Any]] = None
metadata: Optional[Mapping[str, Any]] = None
steps: int = 0
iteration_duration_map: Optional[dict[str, float]] = None


class IterationRunFailedEvent(BaseIterationEvent):
start_at: datetime = Field(..., description="start at")
inputs: Optional[dict[str, Any]] = None
outputs: Optional[dict[str, Any]] = None
metadata: Optional[dict[str, Any]] = None
inputs: Optional[Mapping[str, Any]] = None
outputs: Optional[Mapping[str, Any]] = None
metadata: Optional[Mapping[str, Any]] = None
steps: int = 0
error: str = Field(..., description="failed reason")

Expand Down
31 changes: 16 additions & 15 deletions api/core/workflow/nodes/iteration/iteration_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ def _run(self) -> Generator[NodeEvent | InNodeEvent, None, None]:
for index, item in enumerate(iterator_list_value):
future: Future = thread_pool.submit(
self._run_single_iter_parallel,
current_app._get_current_object(), # type: ignore
q,
iterator_list_value,
inputs,
outputs,
start_at,
graph_engine,
iteration_graph,
index,
item,
iter_run_map,
flask_app=current_app._get_current_object(), # type: ignore
q=q,
iterator_list_value=iterator_list_value,
inputs=inputs,
outputs=outputs,
start_at=start_at,
graph_engine=graph_engine,
iteration_graph=iteration_graph,
index=index,
item=item,
iter_run_map=iter_run_map,
)
future.add_done_callback(thread_pool.task_done_callback)
futures.append(future)
Expand Down Expand Up @@ -370,9 +370,9 @@ def _handle_event_metadata(
def _run_single_iter(
self,
*,
iterator_list_value: list[str],
iterator_list_value: Sequence[str],
variable_pool: VariablePool,
inputs: dict[str, list],
inputs: Mapping[str, list],
outputs: list,
start_at: datetime,
graph_engine: "GraphEngine",
Expand Down Expand Up @@ -559,10 +559,11 @@ def _run_single_iter(

def _run_single_iter_parallel(
self,
*,
flask_app: Flask,
q: Queue,
iterator_list_value: list[str],
inputs: dict[str, list],
iterator_list_value: Sequence[str],
inputs: Mapping[str, list],
outputs: list,
start_at: datetime,
graph_engine: "GraphEngine",
Expand Down
8 changes: 5 additions & 3 deletions api/schedule/clean_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ def clean_messages():
db.session.query(Message)
.filter(Message.created_at < plan_sandbox_clean_message_day)
.order_by(Message.created_at.desc())
.paginate(page=page, per_page=100)
.limit(100)
.all()
)

except NotFound:
break
if messages.items is None or len(messages.items) == 0:
if not messages:
break
for message in messages.items:
for message in messages:
plan_sandbox_clean_message_day = message.created_at
app = App.query.filter_by(id=message.app_id).first()
features_cache_key = f"features:{app.tenant_id}"
plan_cache = redis_client.get(features_cache_key)
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.1
image: langgenius/dify-api:0.13.2
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.1
image: langgenius/dify-api:0.13.2
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.1
image: langgenius/dify-web:0.13.2
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.1
image: langgenius/dify-api:0.13.2
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.1
image: langgenius/dify-api:0.13.2
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.1
image: langgenius/dify-web:0.13.2
restart: always
environment:
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
Expand Down
18 changes: 16 additions & 2 deletions web/app/components/base/toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,25 @@ Toast.notify = ({
const holder = document.createElement('div')
const root = createRoot(holder)

root.render(<Toast type={type} size={size} message={message} duration={duration} className={className} />)
root.render(
<ToastContext.Provider value={{
notify: () => {},
close: () => {
if (holder) {
root.unmount()
holder.remove()
}
},
}}>
<Toast type={type} size={size} message={message} duration={duration} className={className} />
</ToastContext.Provider>,
)
document.body.appendChild(holder)
setTimeout(() => {
if (holder)
if (holder) {
root.unmount()
holder.remove()
}
}, duration || defaultDuring)
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dify-web",
"version": "0.13.1",
"version": "0.13.2",
"private": true,
"engines": {
"node": ">=18.17.0"
Expand Down

0 comments on commit 9ba6005

Please sign in to comment.