mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-02 12:22:39 +02:00
format code
This commit is contained in:
parent
60d34f4a50
commit
549cb2d90b
3 changed files with 27 additions and 26 deletions
|
|
@ -5,8 +5,8 @@
|
|||
# @Version : None
|
||||
# @Description : None
|
||||
|
||||
import time
|
||||
import json
|
||||
import time
|
||||
from multiprocessing import Pipe
|
||||
|
||||
|
||||
|
|
@ -21,17 +21,8 @@ class StreamPipe:
|
|||
"model": "gpt-3.5-turbo-0125",
|
||||
"system_fingerprint": "fp_3bc1b5746c",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"delta":
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "content"
|
||||
},
|
||||
"logprobs": None,
|
||||
"finish_reason": None
|
||||
}
|
||||
]
|
||||
{"index": 0, "delta": {"role": "assistant", "content": "content"}, "logprobs": None, "finish_reason": None}
|
||||
],
|
||||
}
|
||||
|
||||
def set_message(self, msg):
|
||||
|
|
@ -44,6 +35,6 @@ class StreamPipe:
|
|||
return None
|
||||
|
||||
def msg2stream(self, msg):
|
||||
self.format_data['created'] = int(time.time())
|
||||
self.format_data['choices'][0]['delta']['content'] = msg
|
||||
self.format_data["created"] = int(time.time())
|
||||
self.format_data["choices"][0]["delta"]["content"] = msg
|
||||
return f"data: {json.dumps(self.format_data, ensure_ascii=False)}\n".encode("utf-8")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue