Merge pull request #82 from SuanmoSuanyangTechnology/feat/memory-perceptual

Feat/memory perceptual
This commit is contained in:
Mark
2026-01-12 21:16:14 +08:00
committed by GitHub
4 changed files with 13 additions and 3 deletions

View File

@@ -338,7 +338,6 @@ class WorkflowExecutor:
chunk_count += 1
event_type = data.get("type", "node_chunk") # "message" or "node_chunk"
logger.info(f"[CUSTOM] ✅ 收到 {event_type} #{chunk_count} from {data.get('node_id')}")
yield {
"event": event_type, # "message" or "node_chunk"
"data": {
@@ -347,7 +346,8 @@ class WorkflowExecutor:
"full_content": data.get("full_content"),
"chunk_index": data.get("chunk_index"),
"is_prefix": data.get("is_prefix"),
"is_suffix": data.get("is_suffix")
"is_suffix": data.get("is_suffix"),
"conversation_id": input_data.get("conversation_id"),
}
}

View File

@@ -44,6 +44,9 @@ class PerceptualMemoryItem(BaseModel):
summary: Optional[str] = Field(None, description="summary")
storage_type: FileStorageType = Field(..., description="Storage type for file")
created_time: int = Field(..., description="create time")
topic: str = Field(..., description="topic")
domain: str = Field(..., description="domain")
keywords: list[str] = Field(..., description="keywords")
class Config:
from_attributes = True

View File

@@ -136,6 +136,9 @@ class MemoryPerceptualService:
memory_items = []
for memory in memories:
meta_data = memory.meta_data or {}
content = meta_data.get("content")
content = Content(**content)
memory_item = PerceptualMemoryItem(
id=memory.id,
perceptual_type=PerceptualType(memory.perceptual_type),
@@ -143,6 +146,9 @@ class MemoryPerceptualService:
file_name=memory.file_name,
file_ext=memory.file_ext,
summary=memory.summary,
topic=content.topic,
domain=content.domain,
keywords=content.keywords,
created_time=int(memory.created_time.timestamp()*1000),
storage_type=FileStorageType(memory.storage_service),
)

View File

@@ -35,7 +35,8 @@ You are a professional dialogue content summarizer, specializing in extracting c
1. `theme`: A concise phrase describing the conversations core topic (e.g., "inquiry about delivery time rules");
2. `summary`: A single sentence including "user request + AI response + interaction logic" (≤150 words);
3. `takeaways`: A list of brief bullet-point takeaways summarizing the key points from the conversation (e.g., ["User clarified delivery time differences between regular and remote areas"]).
4. `question`: A list of brief declarative statements summarizing the pitfalls the user encountered during the current conversation.Return an empty list if none are present.
4. `question`: The `question` field is a list of brief declarative statements describing objective pitfalls or problems the user actually encountered during the current conversation.
Strict rules: Only include problems that clearly and directly affected task progress. Each item must be a short, factual, declarative statement. Only record issues that are explicitly observable from the conversation. Do NOT include assumptions, interpretations, or stylistic judgments.
5. `info_score`: Numerical score (0100) representing conversation information richness.
- Language Style: Concise, objective, conversational (avoid overly formal terms).