syempuna commited on
Commit
41fa1a1
·
verified ·
1 Parent(s): 3adc01b

tambah chat

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -45,9 +45,14 @@ def root():
45
  @app.post("/chat", response_model=ChatResponse)
46
  def chat_endpoint(req: ChatRequest):
47
  try:
48
- # TODO: Implementasi actual chatbot logic di sini
49
- # Contoh dengan InferenceClient atau model lainnya
50
- response_text = f"Simulasi jawaban untuk: {req.message}"
 
 
 
 
 
51
 
52
  return ChatResponse(
53
  response=response_text,
@@ -55,7 +60,7 @@ def chat_endpoint(req: ChatRequest):
55
  )
56
  except Exception as e:
57
  return ChatResponse(
58
- response=f"Error: {str(e)}",
59
  status="error"
60
  )
61
 
 
45
  @app.post("/chat", response_model=ChatResponse)
46
  def chat_endpoint(req: ChatRequest):
47
  try:
48
+ response_text = chat_indonesian(
49
+ message=req.message,
50
+ history=req.history,
51
+ system_message=req.system_message,
52
+ max_tokens=req.max_tokens,
53
+ temperature=req.temperature,
54
+ model_type=req.model
55
+ )
56
 
57
  return ChatResponse(
58
  response=response_text,
 
60
  )
61
  except Exception as e:
62
  return ChatResponse(
63
+ response=f"Maaf, terjadi kesalahan: {str(e)}",
64
  status="error"
65
  )
66