Skip to content

Commit 425a2cb

Browse files
authored
[Fix][REST] Use lowered-cased "app" (mlc-ai#1159)
1 parent 0a9d6c7 commit 425a2cb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/mlc_chat/rest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ async def lifespan(_app: FastAPI):
143143

144144
origins = ["*"]
145145

146-
APP = FastAPI(lifespan=lifespan)
147-
APP.add_middleware(
146+
app = FastAPI(lifespan=lifespan)
147+
app.add_middleware(
148148
CORSMiddleware,
149149
allow_origins=origins,
150150
allow_credentials=True,
@@ -177,7 +177,7 @@ async def __anext__(self):
177177
raise StopAsyncIteration
178178

179179

180-
@APP.post("/v1/chat/completions")
180+
@app.post("/v1/chat/completions")
181181
async def request_chat_completion(request: ChatCompletionRequest):
182182
"""
183183
Creates model response for the given chat conversation.
@@ -248,7 +248,7 @@ async def iter_response():
248248
)
249249

250250

251-
@APP.post("/v1/completions")
251+
@app.post("/v1/completions")
252252
async def request_completion(request: CompletionRequest):
253253
"""
254254
Creates a completion for a given prompt.
@@ -309,7 +309,7 @@ async def iter_response():
309309
)
310310

311311

312-
@APP.post("/v1/embeddings")
312+
@app.post("/v1/embeddings")
313313
async def request_embeddings(request: EmbeddingsRequest):
314314
"""
315315
Gets embedding for some text.
@@ -335,23 +335,23 @@ async def request_embeddings(request: EmbeddingsRequest):
335335
)
336336

337337

338-
@APP.post("/chat/reset")
338+
@app.post("/chat/reset")
339339
async def reset():
340340
"""
341341
Reset the chat for the currently initialized model.
342342
"""
343343
session["chat_mod"].reset_chat()
344344

345345

346-
@APP.get("/stats")
346+
@app.get("/stats")
347347
async def read_stats():
348348
"""
349349
Get the runtime stats.
350350
"""
351351
return session["chat_mod"].stats()
352352

353353

354-
@APP.get("/verbose_stats")
354+
@app.get("/verbose_stats")
355355
async def read_stats_verbose():
356356
"""
357357
Get the verbose runtime stats.

0 commit comments

Comments
 (0)