prompt read from stdin
This commit is contained in:
@@ -48,6 +48,7 @@ def parse_args():
|
|||||||
mxg.add_argument("--pull")
|
mxg.add_argument("--pull")
|
||||||
#mxg.add_argument("--chat", action=argparse.BooleanOptionalAction, default=True)
|
#mxg.add_argument("--chat", action=argparse.BooleanOptionalAction, default=True)
|
||||||
mxg.add_argument("--response", action="store_true")
|
mxg.add_argument("--response", action="store_true")
|
||||||
|
mxg.add_argument("--instruct", action="store_true")
|
||||||
mxg.add_argument("--endpoint",
|
mxg.add_argument("--endpoint",
|
||||||
default="/api/chat",
|
default="/api/chat",
|
||||||
choices=[
|
choices=[
|
||||||
@@ -86,7 +87,7 @@ async def do_async_turn(conf):
|
|||||||
"""Do user->assistant turn streaming responses"""
|
"""Do user->assistant turn streaming responses"""
|
||||||
if not conf.prompt:
|
if not conf.prompt:
|
||||||
prompt = Prompt.ask(f"[{str(bb.model)}]Ask {conf.model}»[/] [{str(bb.prompt)}]")
|
prompt = Prompt.ask(f"[{str(bb.model)}]Ask {conf.model}»[/] [{str(bb.prompt)}]")
|
||||||
if conf.response:
|
if conf.response or conf.instruct:
|
||||||
system_and_user = {
|
system_and_user = {
|
||||||
"input": conf.prompt or prompt,
|
"input": conf.prompt or prompt,
|
||||||
"instructions": conf.system}
|
"instructions": conf.system}
|
||||||
@@ -143,6 +144,8 @@ async def do_async_turn(conf):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
conf = parse_args()
|
conf = parse_args()
|
||||||
|
if conf.prompt == "-"
|
||||||
|
conf.prompt = sys.stdin.read()
|
||||||
if conf.prompt:
|
if conf.prompt:
|
||||||
write(f"[{str(bb.model)}]Ask {conf.model}»[/] [{str(bb.prompt)}]{conf.prompt}[/]")
|
write(f"[{str(bb.model)}]Ask {conf.model}»[/] [{str(bb.prompt)}]{conf.prompt}[/]")
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user