ThongCoding commited on
Commit
b76bdd4
·
verified ·
1 Parent(s): 52c80f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -10,7 +10,7 @@ translator_en2vi = GoogleTranslator(source='en', target='vi')
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
13
- system_message,
14
  max_tokens=128,
15
  temperature=0.5,
16
  top_p=0.9,
@@ -44,17 +44,12 @@ def respond(
44
  stream=True
45
  ):
46
  # Tiến hành nhận phản hồi từ mô hình
47
- token = chunk.choices[0].delta.content
48
- response += token
49
 
50
  except Exception as e:
51
  return f"Error: {str(e)}"
52
 
53
- # Dịch câu trả lời về tiếng Việt
54
- try:
55
- response_vi = translator_en2vi.translate(response)
56
- except Exception:
57
- response_vi = "(Không thể dịch câu trả lời về tiếng Việt)"
58
 
59
  return response_vi
60
 
 
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
13
+ system_message="You are a helpful assistant.",
14
  max_tokens=128,
15
  temperature=0.5,
16
  top_p=0.9,
 
44
  stream=True
45
  ):
46
  # Tiến hành nhận phản hồi từ mô hình
47
+ response += chunk['choices'][0]['delta']['content']
 
48
 
49
  except Exception as e:
50
  return f"Error: {str(e)}"
51
 
52
+ response_vi = translator_en2vi.translate(response)
 
 
 
 
53
 
54
  return response_vi
55