-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Release: Chat and Cache Improvements, Websocket Integration, and Da…
…rk Mode Enhancements 🌙 (#220) This release brings a series of new features and improvements, including: - 💬 Chat and Cache Improvements: - Refactored cache-related functions and moved them to a new base.py module - Simplified the Chat component and added chat history support - Implemented the ability to send file responses in chat - Real-time Node validation for improved user experience - CacheManager was added to share data between tools and display them in the chat. - 🌐 Websocket Integration: - Implemented websocket connection for the chat (WIP) - 🌙 Dark Mode Enhancements: - Fixed dark mode for dropdown components - Improved dark mode styling for the chat interface - Updated thought icon for dark mode - 🚀 Other Improvements: - Migrated chat logic to chat modal - Implemented unique IDs for flow management - Sorted sidebar items for better organization - Removed unused imports and optimized codebase This release enhances the overall user experience and streamlines chat and cache functionalities, ensuring a smoother and more efficient workflow. 🎉
- Loading branch information
Showing
85 changed files
with
3,770 additions
and
1,811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# LangFlow Demo Codespace Readme | ||
|
||
These instructions will walk you through the process of running a LangFlow demo via GitHub Codespaces. | ||
|
||
## Setup | ||
|
||
### Create a Codespace in GitHub | ||
|
||
To setup the demo, simply navigate to the Langflow repo, click the "+" button, and select "Create new Codespace". This will automatically create a new codespace in your browser, which you can use for the demo. | ||
|
||
### Wait for everything to install | ||
|
||
After the codespace is opened, you should see a new Terminal window in VS Code where langflow is installed. Once the install completes, `langflow` will launch the webserver and your application will be available via devcontainer port. | ||
|
||
Note: VS Code should prompt you with a button to push once the port is available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/universal | ||
{ | ||
"name": "LangChain Demo Container", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/python:3.10", | ||
"features": { | ||
"ghcr.io/devcontainers/features/aws-cli:1": {}, | ||
"ghcr.io/devcontainers/features/docker-in-docker": {}, | ||
"ghcr.io/devcontainers/features/node": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"actboy168.tasks", | ||
"GitHub.copilot", | ||
"ms-python.python", | ||
"eamodio.gitlens" | ||
] | ||
} | ||
}, | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pipx install 'langflow>=0.0.33' && langflow --host 0.0.0.0" | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from langflow.interface.loading import load_flow_from_json # noqa | ||
from langflow.interface.loading import load_flow_from_json | ||
from langflow.cache import cache_manager | ||
|
||
__all__ = ["load_flow_from_json", "cache_manager"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Any | ||
from langchain.callbacks.base import AsyncCallbackHandler | ||
|
||
from langflow.api.schemas import ChatResponse | ||
|
||
|
||
# https://github.com/hwchase17/chat-langchain/blob/master/callback.py | ||
class StreamingLLMCallbackHandler(AsyncCallbackHandler): | ||
"""Callback handler for streaming LLM responses.""" | ||
|
||
def __init__(self, websocket): | ||
self.websocket = websocket | ||
|
||
async def on_llm_new_token(self, token: str, **kwargs: Any) -> None: | ||
resp = ChatResponse(message=token, type="stream", intermediate_steps="") | ||
await self.websocket.send_json(resp.dict()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from fastapi import APIRouter, WebSocket | ||
|
||
from langflow.api.chat_manager import ChatManager | ||
from langflow.utils.logger import logger | ||
|
||
router = APIRouter() | ||
chat_manager = ChatManager() | ||
|
||
|
||
@router.websocket("/chat/{client_id}") | ||
async def websocket_endpoint(client_id: str, websocket: WebSocket): | ||
"""Websocket endpoint for chat.""" | ||
try: | ||
await chat_manager.handle_websocket(client_id, websocket) | ||
except Exception as e: | ||
# Log stack trace | ||
logger.exception(e) | ||
raise e |
Oops, something went wrong.