MCPcopy Create free account
hub / github.com/Akegarasu/ChatGLM-webui / predict

Function predict

modules/ui.py:14–32  ·  view source on GitHub ↗
(ctx, query, max_length, top_p, temperature, use_stream_chat)

Source from the content-addressed store, hash-verified

12
13
14def predict(ctx, query, max_length, top_p, temperature, use_stream_chat):
15 ctx.limit_round()
16 flag = True
17 for _, output in infer(
18 query=query,
19 history=ctx.history,
20 max_length=max_length,
21 top_p=top_p,
22 temperature=temperature,
23 use_stream_chat=use_stream_chat
24 ):
25 if flag:
26 ctx.append(query, output)
27 flag = False
28 else:
29 ctx.update_last(query, output)
30 yield ctx.rh, ""
31 ctx.refresh_last()
32 yield ctx.rh, ""
33
34
35def clear_history(ctx):

Callers

nothing calls this directly

Calls 5

inferFunction · 0.90
limit_roundMethod · 0.80
appendMethod · 0.80
update_lastMethod · 0.80
refresh_lastMethod · 0.80

Tested by

no test coverage detected