feat(agent):Thinking content External vis processing

This commit is contained in:
yhjun1026
2025-04-23 20:34:57 +08:00
parent 9ca60b0e14
commit ff6747cb1f
6 changed files with 19 additions and 124 deletions

View File

@@ -1,96 +0,0 @@
[system]
# Load language from environment variable(It is set by the hook)
language = "${env:DBGPT_LANG:-zh}"
log_level = "INFO"
api_keys = []
encrypt_key = "your_secret_key"
# Server Configurations
[service.web]
host = "127.0.0.1"
port = 5670
[service.web.database]
type = "sqlite"
path = "pilot/meta_data/dbgpt.db"
#[service.web.database]
# type = "mysql"
# host = "127.0.0.1"
# port = 3306
# user = "root"
# database = "dbgpt"
# password = "aa12345678"
[service.model.worker]
host = "127.0.0.1"
[rag]
chunk_size=1000
chunk_overlap=0
similarity_top_k=5
similarity_score_threshold=0.0
max_chunks_once_load=10
max_threads=1
rerank_top_k=3
graph_community_summary_enabled="True"
enable_summary=true
[rag.storage]
[rag.storage.vector]
type = "Chroma"
persist_path = "pilot/data"
#type = "ElasticSearch"
#uri = "127.0.0.1"
#port = "19530"
#username="dbgpt"
#password=19530
[rag.storage.graph]
type = "TuGraph"
host="127.0.0.1"
port=7687
username="admin"
password="73@TuGraph"
enable_summary=true
enable_similarity_search=false
[rag.storage.full_text]
type = "ElasticSearch"
host="127.0.0.1"
port=9200
#GRAPH_COMMUNITY_SUMMARY_ENABLED=True # enable the graph community summary
#TRIPLET_GRAPH_ENABLED=True # enable the graph search for the triplets
#DOCUMENT_GRAPH_ENABLED=True # enable the graph search for documents and chunks
#KNOWLEDGE_GRAPH_EXTRACTION_BATCH_SIZE=20 # the batch size of triplet extraction from the text
#COMMUNITY_SUMMARY_BATCH_SIZE=20 # the batch size of parallel community summary process
# Model Configurations
[models]
[[models.llms]]
#name = "deepseek-chat"
#provider = "proxy/deepseek"
#provider = "proxy/vol-deepseek"
#api_key = "${env:DEEPSEEK_API_KEY}"
#name = "${env:LLM_MODEL_NAME:-deepseek-chat}"
#provider = "${env:LLM_MODEL_PROVIDER:-proxy/deepseek}"
#api_url = "https://zdfmng.alipay.com/chat/completions"
#api_key = "sk-adf80a1b814cf1193422fabcd34ccc0a"
#api_key = "sk-04bec639baf54da7b743016e8536a459"
name = "Qwen2.5-72B-Instruct"
provider = "proxy/gitee"
api_key = "W7LRHBLWM0XMW0AGLDRKEITZNZCSUUHAVFOYWO1C"
[[models.embeddings]]
name = "bge-large-zh-v1.5"
provider = "proxy/openai"
api_url = "https://ai.gitee.com/v1/embeddings"
api_key = "W7LRHBLWM0XMW0AGLDRKEITZNZCSUUHAVFOYWO1C"

View File

@@ -611,17 +611,11 @@ class ConversableAgent(Role, Agent):
"content": res_content,
"avatar": self.avatar,
}
if not self.not_null_agent_context.output_process_message:
if self.is_final_role:
await self.memory.gpts_memory.push_message(
self.not_null_agent_context.conv_id,
stream_msg=temp_message,
)
else:
await self.memory.gpts_memory.push_message(
self.not_null_agent_context.conv_id,
stream_msg=temp_message,
)
await self.memory.gpts_memory.push_message(
self.not_null_agent_context.conv_id,
stream_msg=temp_message,
)
return res_thinking, res_content, llm_model
except LLMChatError as e:

View File

@@ -158,7 +158,7 @@ class AIWrapper:
model_request.copy()
): # type: ignore
model_output = output
parsed_output = model_output.text_and_thinking()
parsed_output = model_output.gen_text_and_thinking()
think_blank = not parsed_output[0] or len(parsed_output[0]) <= 0
content_blank = not parsed_output[1] or len(parsed_output[1]) <= 0

View File

@@ -171,7 +171,7 @@ class DefaultVisConverter(VisProtocolConverter):
}
)
if stream_msg:
simple_message_list.append(self._view_stream_message(stream_msg))
simple_message_list.append(await self._view_stream_message(stream_msg))
return simple_message_list
@@ -181,7 +181,7 @@ class DefaultVisConverter(VisProtocolConverter):
messages_view.append(
{
"sender": message["sender"],
"receiver": message["receiver"],
"receiver": message.get("receiver"),
"model": message["model"],
"markdown": message["markdown"],
}
@@ -193,4 +193,4 @@ class DefaultVisConverter(VisProtocolConverter):
self,
stream_msg: Optional[Union[Dict, str]] = None,
):
return self._view_stream_message(stream_msg)
return await self._view_stream_message(stream_msg)

View File

@@ -142,7 +142,7 @@ class MultiAgents(BaseComponent, ABC):
).create()
storage_manager = StorageManager.get_instance(self.system_app)
index_name = "_agent_memory_"
index_name = "agent_memory"
vector_store = storage_manager.create_vector_store(index_name=index_name)
if not vector_store.vector_name_exists():
vector_store.create_collection(collection_name=index_name)
@@ -312,7 +312,9 @@ class MultiAgents(BaseComponent, ABC):
vis_protocal = None
# if enable_verbose:
## Defaul use gpt_vis ui components package
# vis_protocal = GptVisConverter()
from dbgpt_ext.vis.gpt_vis.gpt_vis_converter_v2 import GptVisConverterNew
vis_protocal = GptVisConverterNew()
self.memory.init(
agent_conv_id,

View File

@@ -368,6 +368,7 @@ class GptsAppDetailEntity(Model):
app_name = Column(String(255), nullable=False, comment="Current AI assistant name")
type = Column(
String(255),
default="agent",
nullable=False,
comment="bind detail agent type. 'app' or 'agent', default 'agent'",
)
@@ -804,7 +805,7 @@ class GptsAppDao(BaseDao):
else:
return app_info
async def auto_team_bin_apps(self, team_app_code: str, bind_apps: List[str]):
async def app_bind_apps(self, team_app_code: str, bind_apps: List[str]):
"""Convert the gpts app to a sub-agent of the current application."""
logger.info(f"auto_team_bin_apps:{team_app_code},{bind_apps}")
team_app: GptsApp = self.app_detail(team_app_code)
@@ -827,19 +828,13 @@ class GptsAppDao(BaseDao):
for gpt_app in gpt_apps:
## 暂时线只支持绑定单agent应用多Agent应用绑定要把多Agent的子Agent资源提到绑定的TL Agent上可能需要产品测来定义 #noqa
if gpt_app.team_mode == TeamMode.SINGLE_AGENT.value:
new_detail: GptsAppDetail = gpt_app.details[0].copy()
new_detail: GptsAppDetail = GptsAppDetail()
new_detail.app_name = team_app.app_name
new_detail.app_code = team_app.app_code
strategy_values = json.loads(gpt_app.details[0].llm_strategy_value)
# 恢复模拟前端的数据
new_detail.llm_strategy_value = ",".join(strategy_values)
new_detail.agent_describe = gpt_app.app_describe
new_detail.agent_role = (
new_detail.agent_role
if new_detail.agent_role
else new_detail.agent_name
)
new_detail.type = "app"
new_detail.agent_name = gpt_app.app_name
new_detail.agent_role = gpt_app.app_code
new_detail.agent_describe = gpt_app.app_describe
team_app.details.append(new_detail)
self.edit(team_app)