Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def respond(message):
|
|
17 |
|
18 |
# 強化 Prompt 讓模型輸出更合理
|
19 |
instruction = (
|
20 |
-
"
|
21 |
"User: " + message + "\n"
|
22 |
"Assistant: "
|
23 |
)
|
@@ -25,7 +25,7 @@ def respond(message):
|
|
25 |
# Generate response with improved settings
|
26 |
response = pipe(
|
27 |
instruction,
|
28 |
-
max_length=
|
29 |
truncation=True,
|
30 |
num_return_sequences=1,
|
31 |
temperature=0.3, # 保持一定創意但減少胡言亂語
|
|
|
17 |
|
18 |
# 強化 Prompt 讓模型輸出更合理
|
19 |
instruction = (
|
20 |
+
"請用簡單、繁體中文、準確的語言回答問題,避免冗長和重複內容,重點摘要至512 tokens。\n"
|
21 |
"User: " + message + "\n"
|
22 |
"Assistant: "
|
23 |
)
|
|
|
25 |
# Generate response with improved settings
|
26 |
response = pipe(
|
27 |
instruction,
|
28 |
+
max_length=1024, # 限制最大輸出長度,防止無限重複
|
29 |
truncation=True,
|
30 |
num_return_sequences=1,
|
31 |
temperature=0.3, # 保持一定創意但減少胡言亂語
|