mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
feat: add config for model selection #471
This commit is contained in:
29
channel/terminal/terminal_channel.py
Normal file
29
channel/terminal/terminal_channel.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from channel.channel import Channel
|
||||
import sys
|
||||
|
||||
class TerminalChannel(Channel):
|
||||
def startup(self):
|
||||
context = {"from_user_id": "User"}
|
||||
print("\nPlease input your question")
|
||||
while True:
|
||||
try:
|
||||
prompt = self.get_input("User:\n")
|
||||
except KeyboardInterrupt:
|
||||
print("\nExiting...")
|
||||
sys.exit()
|
||||
|
||||
print("Bot:")
|
||||
sys.stdout.flush()
|
||||
for res in super().build_reply_content(prompt, context):
|
||||
print(res, end="")
|
||||
sys.stdout.flush()
|
||||
print("\n")
|
||||
|
||||
|
||||
def get_input(self, prompt):
|
||||
"""
|
||||
Multi-line input function
|
||||
"""
|
||||
print(prompt, end="")
|
||||
line = input()
|
||||
return line
|
||||
Reference in New Issue
Block a user