🐛 fix(chat.py): remove unused user dependency in stream_build function
🐛 fix(chat.py): handle KeyError when retrieving user_id from cache_service ✨ feat(chat.py): use user_id from cache_service instead of user.id in try_running_celery_task and vertex.build functions 🔧 chore(config.yaml): comment out ConversationChain in chains configuration 🔧 chore(base.py): import SQLDatabaseChain from langchain_experimental.sql module and add it to type_dict
This commit is contained in:
parent
364d36d194
commit
9b23dae530
3 changed files with 11 additions and 6 deletions
|
|
@ -127,7 +127,6 @@ async def stream_build(
|
||||||
flow_id: str,
|
flow_id: str,
|
||||||
chat_service: "ChatService" = Depends(get_chat_service),
|
chat_service: "ChatService" = Depends(get_chat_service),
|
||||||
cache_service: "BaseCacheService" = Depends(get_cache_service),
|
cache_service: "BaseCacheService" = Depends(get_cache_service),
|
||||||
user=Depends(get_current_active_user),
|
|
||||||
):
|
):
|
||||||
"""Stream the build process based on stored flow data."""
|
"""Stream the build process based on stored flow data."""
|
||||||
|
|
||||||
|
|
@ -161,6 +160,11 @@ async def stream_build(
|
||||||
number_of_nodes = len(graph.nodes)
|
number_of_nodes = len(graph.nodes)
|
||||||
update_build_status(cache_service, flow_id, BuildStatus.IN_PROGRESS)
|
update_build_status(cache_service, flow_id, BuildStatus.IN_PROGRESS)
|
||||||
|
|
||||||
|
try:
|
||||||
|
user_id = cache_service[flow_id]["user_id"]
|
||||||
|
except KeyError:
|
||||||
|
logger.debug("No user_id found in cache_service")
|
||||||
|
user_id = None
|
||||||
for i, vertex in enumerate(graph.generator_build(), 1):
|
for i, vertex in enumerate(graph.generator_build(), 1):
|
||||||
try:
|
try:
|
||||||
log_dict = {
|
log_dict = {
|
||||||
|
|
@ -168,9 +172,9 @@ async def stream_build(
|
||||||
}
|
}
|
||||||
yield str(StreamData(event="log", data=log_dict))
|
yield str(StreamData(event="log", data=log_dict))
|
||||||
if vertex.is_task:
|
if vertex.is_task:
|
||||||
vertex = try_running_celery_task(vertex, user.id)
|
vertex = try_running_celery_task(vertex, user_id)
|
||||||
else:
|
else:
|
||||||
vertex.build(user_id=user.id)
|
vertex.build(user_id=user_id)
|
||||||
params = vertex._built_object_repr()
|
params = vertex._built_object_repr()
|
||||||
valid = True
|
valid = True
|
||||||
logger.debug(f"Building node {str(vertex.vertex_type)}")
|
logger.debug(f"Building node {str(vertex.vertex_type)}")
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ chains:
|
||||||
documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_math"
|
documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_math"
|
||||||
LLMCheckerChain:
|
LLMCheckerChain:
|
||||||
documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_checker"
|
documentation: "https://python.langchain.com/docs/modules/chains/additional/llm_checker"
|
||||||
ConversationChain:
|
# ConversationChain:
|
||||||
documentation: ""
|
# documentation: ""
|
||||||
SeriesCharacterChain:
|
SeriesCharacterChain:
|
||||||
documentation: ""
|
documentation: ""
|
||||||
MidJourneyPromptChain:
|
MidJourneyPromptChain:
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ from langflow.template.frontend_node.chains import ChainFrontendNode
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from langflow.utils.util import build_template_from_class, build_template_from_method
|
from langflow.utils.util import build_template_from_class, build_template_from_method
|
||||||
from langchain import chains
|
from langchain import chains
|
||||||
|
from langchain_experimental.sql import SQLDatabaseChain
|
||||||
|
|
||||||
# Assuming necessary imports for Field, Template, and FrontendNode classes
|
# Assuming necessary imports for Field, Template, and FrontendNode classes
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@ class ChainCreator(LangChainTypeCreator):
|
||||||
}
|
}
|
||||||
from langflow.interface.chains.custom import CUSTOM_CHAINS
|
from langflow.interface.chains.custom import CUSTOM_CHAINS
|
||||||
|
|
||||||
# self.type_dict["SQLDatabaseChain"] = SQLDatabaseChain
|
self.type_dict["SQLDatabaseChain"] = SQLDatabaseChain
|
||||||
|
|
||||||
self.type_dict.update(CUSTOM_CHAINS)
|
self.type_dict.update(CUSTOM_CHAINS)
|
||||||
# Filter according to settings.chains
|
# Filter according to settings.chains
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue