htchu Claude Haiku 5.5 commited on
Commit
1335812
·
1 Parent(s): 2ac826a

Switch Coder Helper UI and default prompt to Traditional Chinese

Browse files

Translate the title, description, control labels and example prompts,
and ask the model to answer in Traditional Chinese by default.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -8,9 +8,9 @@ LLM_API_KEY = os.environ.get("LLM_API_KEY", "")
8
  LLM_MODEL = os.environ.get("LLM_MODEL", "Qwen/Qwen2.5-Coder-7B-Instruct-AWQ")
9
 
10
  DEFAULT_SYSTEM_PROMPT = (
11
- "You are a helpful programming assistant. Explain concepts clearly, "
12
- "write correct and readable code, and point out bugs or edge cases. "
13
- "Put code in fenced code blocks with the language name."
14
  )
15
 
16
  client = OpenAI(base_url=LLM_BASE_URL, api_key=LLM_API_KEY)
@@ -41,18 +41,18 @@ def respond(message, history, model, system_prompt, max_tokens, temperature):
41
 
42
  demo = gr.ChatInterface(
43
  fn=respond,
44
- title="Coder Helper",
45
- description="Ask a programming question. Answers come from a self-hosted open LLM.",
46
  additional_inputs=[
47
- gr.Dropdown(choices=[LLM_MODEL], value=LLM_MODEL, allow_custom_value=True, label="Model"),
48
- gr.Textbox(value=DEFAULT_SYSTEM_PROMPT, label="System prompt", lines=3),
49
- gr.Slider(minimum=32, maximum=2048, value=512, step=32, label="Max new tokens"),
50
- gr.Slider(minimum=0.0, maximum=1.5, value=0.2, step=0.1, label="Temperature"),
51
  ],
52
  examples=[
53
- ["Write a Python function that checks whether a string is a palindrome."],
54
- ["Why does a JavaScript `for (var i...)` loop with setTimeout print the same number every time?"],
55
- ["Explain the difference between a process and a thread."],
56
  ],
57
  cache_examples=False,
58
  )
 
8
  LLM_MODEL = os.environ.get("LLM_MODEL", "Qwen/Qwen2.5-Coder-7B-Instruct-AWQ")
9
 
10
  DEFAULT_SYSTEM_PROMPT = (
11
+ "你是一位樂於助人的程式設計助理。請一律使用繁體中文回答,"
12
+ "清楚說明概念,撰寫正確且易讀的程式碼,並指出錯誤或邊界情況。"
13
+ "程式碼請放在附上語言名稱的 fenced code block 中。"
14
  )
15
 
16
  client = OpenAI(base_url=LLM_BASE_URL, api_key=LLM_API_KEY)
 
41
 
42
  demo = gr.ChatInterface(
43
  fn=respond,
44
+ title="程式設計小幫手",
45
+ description="提出程式設計相關的問題,回答由自架的開源大型語言模型產生。",
46
  additional_inputs=[
47
+ gr.Dropdown(choices=[LLM_MODEL], value=LLM_MODEL, allow_custom_value=True, label="模型"),
48
+ gr.Textbox(value=DEFAULT_SYSTEM_PROMPT, label="系統提示詞", lines=3),
49
+ gr.Slider(minimum=32, maximum=2048, value=512, step=32, label="最大輸出 token 數"),
50
+ gr.Slider(minimum=0.0, maximum=1.5, value=0.2, step=0.1, label="溫度"),
51
  ],
52
  examples=[
53
+ ["寫一個 Python 函式,判斷字串是否為回文。"],
54
+ ["為什麼 JavaScript 的 `for (var i...)` 迴圈搭配 setTimeout 每次都印出同一個數字?"],
55
+ ["請說明行程(process)和執行緒(thread)的差別。"],
56
  ],
57
  cache_examples=False,
58
  )