Skip to content

Commit

Permalink
Fixed: color coding user input (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
signebedi committed Apr 2, 2023
1 parent d871c1a commit ea21634
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gptty/gptty.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
from aioconsole import ainput
from datetime import datetime
import os, time, sys, asyncio, json

# prompt toolkit requirements
from prompt_toolkit import PromptSession
from prompt_toolkit.formatted_text import ANSI
from prompt_toolkit.styles import Style

# app specific requirements
from gptty.tagging import get_tag_from_text
Expand Down Expand Up @@ -146,7 +149,7 @@ async def create_chat_room(configs=get_config_data(), log_responses:bool=True, c

# Get user input
try:
i = await session.prompt_async(ANSI(f"{CYAN}> "))
i = await session.prompt_async(ANSI(f"{CYAN}> "), style=Style.from_dict({'': 'ansicyan'}))
# i = await ainput(f"{CYAN}> ")
tag,question = get_tag_from_text(i)
prompt_length = len(question)
Expand Down Expand Up @@ -180,7 +183,7 @@ async def create_chat_room(configs=get_config_data(), log_responses:bool=True, c


# click.echo the question in color
print(f"{CYAN}[{configs['your_name']}] {question}{RESET} \n", end="", flush=True)
print(f"\n{CYAN}[{configs['your_name']}] {question}{RESET} \n", end="", flush=True)

# we create the callable wait_graphic task
wait_task = asyncio.create_task(wait_graphic())
Expand Down

0 comments on commit ea21634

Please sign in to comment.