feat: + summary

This commit is contained in:
莘权 马 2023-09-07 15:55:50 +08:00
parent bda4132a90
commit 7723df1455

View file

@ -6,10 +6,10 @@
@Desc : MetaGPT LLM related APIs
"""
import json
from typing import Dict, List
from pydantic import BaseModel
from metagpt.memory.brain_memory import BrainMemory
from metagpt.provider import OpenAIGPTAPI
@ -19,17 +19,22 @@ class MetaGPTLLMAPI(OpenAIGPTAPI):
def __init__(self):
super().__init__()
async def get_summary(self, memory: BrainMemory, max_words=200, keep_language: bool = False, **kwargs):
async def get_summary(self, history: List[Dict], max_words=200, keep_language: bool = False, **kwargs):
summary = []
class HisMsg(BaseModel):
content: str
tags: set
id: str
class QuweryAnswerPair(BaseModel):
ask: str
answer: str
rh = reversed(memory.history)
rh = reversed(history)
ix = 0
while ix < len(rh):
t = rh[ix]
t = HisMsg(**rh[ix])
print(t)
# 如果 t是ask, continue
pass