INNER CODE UNIT · Python

new

adamyodinsky/TerminalGPT · terminalgpt/main.py:200

def new(ctx):
    """Start a new conversation."""

    enc_manager: EncryptionManager = ctx.obj["ENC_MNGR"]
    chat_manager: ChatManager = ctx.obj["CHAT"]
    conversation_manager: ConversationManager = ctx.obj["CONV_MANAGER"]
    printer: Printer = ctx.obj["PRINTER"]
    client = OpenAI(api_key=enc_manager.get_api_key())

    chat_manager.client = client
    conversation_manager.client = client

    token_limit = int(ctx.obj["TOKEN_LIMIT"] / 1000)
    printer.printt(
        f"{Style.RESET_ALL}{Style.BRIGHT}Model: {Style.RESET_ALL}{ctx.obj['MODEL']} "
        f"{Style.BRIGHT}Token Limit: {Style.RESET_ALL}{token_limit}k "
        f"{Style.RESET_ALL}{Style.BRIGHT}Style: {Style.RESET_ALL}{ctx.obj['STYLE']}"
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…