Skip to content

Commit 1f247b8

Browse files
reidliu41py-andy-c
authored andcommitted
Fix: Add missing EOFError handling in CLI complete command (vllm-project#20896)
Signed-off-by: reidliu41 <reid201711@gmail.com>
1 parent dde52d7 commit 1f247b8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

vllm/entrypoints/cli/openai.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def chat(system_prompt: str | None, model_name: str, client: OpenAI) -> None:
5555
try:
5656
input_message = input("> ")
5757
except EOFError:
58-
return
58+
break
5959
conversation.append({"role": "user", "content": input_message})
6060

6161
chat_completion = client.chat.completions.create(model=model_name,
@@ -118,7 +118,7 @@ def cmd(args: argparse.Namespace) -> None:
118118
try:
119119
input_message = input("> ")
120120
except EOFError:
121-
return
121+
break
122122
conversation.append({"role": "user", "content": input_message})
123123

124124
chat_completion = client.chat.completions.create(
@@ -170,7 +170,10 @@ def cmd(args: argparse.Namespace) -> None:
170170

171171
print("Please enter prompt to complete:")
172172
while True:
173-
input_prompt = input("> ")
173+
try:
174+
input_prompt = input("> ")
175+
except EOFError:
176+
break
174177
completion = client.completions.create(model=model_name,
175178
prompt=input_prompt)
176179
output = completion.choices[0].text

0 commit comments

Comments
 (0)