mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 20:55:09 +01:00
Fix script
This commit is contained in:
@@ -1,14 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import pathlib
|
import pathlib
|
||||||
from typing import Optional
|
|
||||||
import openai
|
|
||||||
from chat_to_files import to_files
|
|
||||||
from ai import AI
|
|
||||||
from steps import STEPS
|
|
||||||
from db import DB, DBs
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
|
from ..ai import AI
|
||||||
|
from ..chat_to_files import to_files
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
|
||||||
@@ -20,17 +16,12 @@ def chat(
|
|||||||
model: str = "gpt-4",
|
model: str = "gpt-4",
|
||||||
temperature: float = 0.1,
|
temperature: float = 0.1,
|
||||||
max_tokens: int = 4096,
|
max_tokens: int = 4096,
|
||||||
n: int = 1,
|
|
||||||
stream: bool = True,
|
|
||||||
):
|
):
|
||||||
|
|
||||||
|
|
||||||
ai = AI(
|
ai = AI(
|
||||||
model=model, temperature=temperature,
|
model=model,
|
||||||
|
temperature=temperature,
|
||||||
max_tokens=max_tokens,
|
max_tokens=max_tokens,
|
||||||
n=n,
|
|
||||||
stream=stream,
|
|
||||||
stop=None,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with open(messages_path) as f:
|
with open(messages_path) as f:
|
||||||
@@ -39,9 +30,9 @@ def chat(
|
|||||||
messages = ai.next(messages)
|
messages = ai.next(messages)
|
||||||
|
|
||||||
if out_path:
|
if out_path:
|
||||||
to_files(messages[-1]['content'], out_path)
|
to_files(messages[-1]["content"], out_path)
|
||||||
with open(pathlib.Path(out_path) / 'all_output.txt', 'w') as f:
|
with open(pathlib.Path(out_path) / "all_output.txt", "w") as f:
|
||||||
json.dump(messages[-1]['content'], f)
|
json.dump(messages[-1]["content"], f)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user