Skip to content

Commit

Permalink
fix: chat_dag_stream error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aries-ckt committed Jul 19, 2024
1 parent 003424a commit 5693b47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
13 changes: 4 additions & 9 deletions dbgpt/app/openapi/api_v1/api_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
from dbgpt.datasource.db_conn_info import DBConfig, DbTypeInfo
from dbgpt.model.base import FlatSupportedModel
from dbgpt.model.cluster import BaseModelController, WorkerManager, WorkerManagerFactory
from dbgpt.rag.knowledge.base import KnowledgeType
from dbgpt.rag.summary.db_summary_client import DBSummaryClient
from dbgpt.serve.agent.agents.controller import multi_agents
from dbgpt.serve.flow.service.service import Service as FlowService
from dbgpt.serve.flow.service.service import _chat_stream_with_dag_task
from dbgpt.util.executor_utils import (
DefaultExecutorFactory,
ExecutorFactory,
Expand Down Expand Up @@ -537,13 +535,10 @@ async def chat_with_business_flow(dialogue: ConversationVo):
incremental=dialogue.incremental,
)
flow_service = FlowService.get_instance(CFG.SYSTEM_APP)
task = await flow_service._get_callable_task("51166a4d-f59a-448f-994e-8f21b05ba1f9")
async for output in _chat_stream_with_dag_task(task, request, False):
text = output.text
async for output in flow_service.chat_stream_flow_str(
"51166a4d-f59a-448f-994e-8f21b05ba1f9", request
):
text = output
if text:
text = text.replace("\n", "\\n")
if output.error_code != 0:
yield f"data:[SERVER_ERROR]{text}\n\n"
break
else:
yield f"data:{text}\n\n"
1 change: 0 additions & 1 deletion dbgpt/rag/knowledge/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Dict, List, Optional, Type, Union

from dbgpt.rag.knowledge.base import Knowledge, KnowledgeType

from dbgpt.rag.knowledge.string import StringKnowledge
from dbgpt.rag.knowledge.url import URLKnowledge

Expand Down

0 comments on commit 5693b47

Please sign in to comment.