shenchucheng commited on
Commit
2ea99b7
·
1 Parent(s): 6a3fde1

format code

Browse files
Files changed (1) hide show
  1. app.py +15 -32
app.py CHANGED
@@ -3,30 +3,28 @@
3
  from __future__ import annotations
4
 
5
  import asyncio
6
- from collections import deque
7
  import contextlib
8
- from functools import partial
9
  import shutil
10
- from datetime import datetime
11
  import traceback
12
  import uuid
 
 
13
  from enum import Enum
14
- from metagpt.logs import set_llm_stream_logfunc
15
- import pathlib
16
 
17
- from fastapi import FastAPI, Request, HTTPException
18
- from fastapi.responses import StreamingResponse, RedirectResponse
19
- from fastapi.staticfiles import StaticFiles
20
  import fire
21
- from pydantic import BaseModel, Field
22
  import uvicorn
23
-
24
- from typing import Any, Optional
25
-
26
- from metagpt.schema import Message
27
  from metagpt.actions.action import Action
28
  from metagpt.actions.action_output import ActionOutput
29
  from metagpt.config import CONFIG
 
 
 
30
 
31
  from software_company import RoleRun, SoftwareCompany
32
 
@@ -133,18 +131,6 @@ class MessageJsonModel(BaseModel):
133
  score: Optional[int] = None
134
  feedback: Optional[str] = None
135
 
136
- def add_think_act(self, think_act_prompt: ThinkActPrompt):
137
- s = Sentences(
138
- action=think_act_prompt.step.title,
139
- skill=think_act_prompt.skill,
140
- description=think_act_prompt.step.description,
141
- timestamp=think_act_prompt.timestamp,
142
- status=think_act_prompt.step.status,
143
- contents=[think_act_prompt.step.content.dict()],
144
- )
145
- self.steps.append(s)
146
-
147
-
148
  def add_think_act(self, think_act_prompt: ThinkActPrompt):
149
  s = Sentences(
150
  action=think_act_prompt.step.title,
@@ -178,7 +164,9 @@ async def create_message(req_model: NewMsg, request: Request):
178
  steps=[
179
  Sentences(
180
  contents=[
181
- Sentence(type=SentenceType.TEXT.value, value=SentenceValue(answer=req_model.query), is_finished=True)
 
 
182
  ],
183
  status=MessageStatus.COMPLETE.value,
184
  )
@@ -228,12 +216,7 @@ async def create_message(req_model: NewMsg, request: Request):
228
  status="failed",
229
  title=description,
230
  description=description,
231
- content=Sentence(
232
- type=SentenceType.ERROR.value,
233
- id=1,
234
- value=SentenceValue(answer=answer),
235
- is_finished=True
236
- ),
237
  )
238
  think_act_prompt = ThinkActPrompt(step=step)
239
  yield think_act_prompt.prompt + "\n\n"
 
3
  from __future__ import annotations
4
 
5
  import asyncio
 
6
  import contextlib
7
+ import pathlib
8
  import shutil
 
9
  import traceback
10
  import uuid
11
+ from collections import deque
12
+ from datetime import datetime
13
  from enum import Enum
14
+ from functools import partial
15
+ from typing import Any, Optional
16
 
 
 
 
17
  import fire
 
18
  import uvicorn
19
+ from fastapi import FastAPI, Request
20
+ from fastapi.responses import StreamingResponse
21
+ from fastapi.staticfiles import StaticFiles
 
22
  from metagpt.actions.action import Action
23
  from metagpt.actions.action_output import ActionOutput
24
  from metagpt.config import CONFIG
25
+ from metagpt.logs import set_llm_stream_logfunc
26
+ from metagpt.schema import Message
27
+ from pydantic import BaseModel, Field
28
 
29
  from software_company import RoleRun, SoftwareCompany
30
 
 
131
  score: Optional[int] = None
132
  feedback: Optional[str] = None
133
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  def add_think_act(self, think_act_prompt: ThinkActPrompt):
135
  s = Sentences(
136
  action=think_act_prompt.step.title,
 
164
  steps=[
165
  Sentences(
166
  contents=[
167
+ Sentence(
168
+ type=SentenceType.TEXT.value, value=SentenceValue(answer=req_model.query), is_finished=True
169
+ )
170
  ],
171
  status=MessageStatus.COMPLETE.value,
172
  )
 
216
  status="failed",
217
  title=description,
218
  description=description,
219
+ content=Sentence(type=SentenceType.ERROR.value, id=1, value=SentenceValue(answer=answer), is_finished=True),
 
 
 
 
 
220
  )
221
  think_act_prompt = ThinkActPrompt(step=step)
222
  yield think_act_prompt.prompt + "\n\n"