Omnibus commited on
Commit
a80d4f2
1 Parent(s): cb13d58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -51,7 +51,7 @@ def format_prompt(message, history):
51
  prompt += f"<start_of_turn>user{message}<end_of_turn><start_of_turn>model"
52
  print(prompt)
53
  return prompt
54
- mega_hist=[]
55
 
56
 
57
  def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,rep_p,hid_val):
@@ -60,19 +60,19 @@ def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,r
60
  #token max=8192
61
  client=client_z[int(hid_val)-1]
62
 
63
- if not mega_hist[hid_val-1]:
64
- mega_hist.append([])
65
  #history = []
66
  hist_len=0
67
- if mega_hist[hid_val-1]:
68
- hist_len=len(mega_hist[hid_val-1])
69
- print(hist_len)
70
- in_len=len(system_prompt+prompt)+hist_len
71
- print("\n#########"+str(in_len))
72
- if (in_len+tokens) > 8000:
73
- yield [(prompt,"Wait. I need to compress our Chat history...")]
74
- #history=compress_history(history,client_choice,seed,temp,tokens,top_p,rep_p)
75
- yield [(prompt,"History has been compressed, processing request...")]
76
 
77
  generate_kwargs = dict(
78
  temperature=temp,
 
51
  prompt += f"<start_of_turn>user{message}<end_of_turn><start_of_turn>model"
52
  print(prompt)
53
  return prompt
54
+ mega_hist=[[],[],[],[]]
55
 
56
 
57
  def chat_inf(system_prompt,prompt,history,client_choice,seed,temp,tokens,top_p,rep_p,hid_val):
 
60
  #token max=8192
61
  client=client_z[int(hid_val)-1]
62
 
63
+ if history:
64
+ mega_hist[hid_val-1]=history
65
  #history = []
66
  hist_len=0
67
+ #if mega_hist[hid_val-1]:
68
+ # hist_len=len(mega_hist[hid_val-1])
69
+ # print(hist_len)
70
+ #in_len=len(system_prompt+prompt)+hist_len
71
+ #print("\n#########"+str(in_len))
72
+ #if (in_len+tokens) > 8000:
73
+ # yield [(prompt,"Wait. I need to compress our Chat history...")]
74
+ # #history=compress_history(history,client_choice,seed,temp,tokens,top_p,rep_p)
75
+ # yield [(prompt,"History has been compressed, processing request...")]
76
 
77
  generate_kwargs = dict(
78
  temperature=temp,