mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-06 10:54:29 +00:00
fix:reference bug
This commit is contained in:
parent
d7f677a59a
commit
6ea9c17aae
@ -174,6 +174,9 @@ class BaseChat(ABC):
|
|||||||
def stream_plugin_call(self, text):
|
def stream_plugin_call(self, text):
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
def stream_call_reinforce_fn(self, text):
|
||||||
|
return text
|
||||||
|
|
||||||
async def check_iterator_end(iterator):
|
async def check_iterator_end(iterator):
|
||||||
try:
|
try:
|
||||||
await asyncio.anext(iterator)
|
await asyncio.anext(iterator)
|
||||||
@ -215,6 +218,7 @@ class BaseChat(ABC):
|
|||||||
view_msg = view_msg.replace("\n", "\\n")
|
view_msg = view_msg.replace("\n", "\\n")
|
||||||
yield view_msg
|
yield view_msg
|
||||||
self.current_message.add_ai_message(msg)
|
self.current_message.add_ai_message(msg)
|
||||||
|
view_msg = self.stream_call_reinforce_fn(view_msg)
|
||||||
self.current_message.add_view_message(view_msg)
|
self.current_message.add_view_message(view_msg)
|
||||||
span.end()
|
span.end()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -89,7 +89,7 @@ class ChatKnowledge(BaseChat):
|
|||||||
last_output = last_output + reference
|
last_output = last_output + reference
|
||||||
yield last_output
|
yield last_output
|
||||||
|
|
||||||
def stream_plugin_call(self, text):
|
def stream_call_reinforce_fn(self, text):
|
||||||
"""return reference"""
|
"""return reference"""
|
||||||
return text + f"\n\n{self.parse_source_view(self.sources)}"
|
return text + f"\n\n{self.parse_source_view(self.sources)}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user