youngtsai commited on
Commit
0db1ae7
·
1 Parent(s): be1f3da

refactor_cutor_prompt

Browse files
Files changed (1) hide show
  1. app.py +184 -184
app.py CHANGED
@@ -1167,6 +1167,32 @@ def verify_moderation(text):
1167
 
1168
  return is_flagged, response_dict
1169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1170
  def assign_grade(subject_content, structure, diction, spelling_punctuation):
1171
  # 定義等級順序
1172
  grade_order = ["A+", "A", "A-", "B+", "B", "B-"]
@@ -1272,49 +1298,92 @@ def get_chinese_paragraph_evaluate_content(thread_id, model, user_content, parag
1272
 
1273
  return total_content_text, content_table
1274
 
1275
-
1276
  def get_chinese_paragraph_1st_evaluate_content(
1277
  thread_id,
1278
  model,
1279
  chinese_assignment_topic,
1280
  chinese_assignment_introduction,
1281
  chinese_assignment_description,
1282
- sys_content,
1283
  paragraph,
1284
- user_generate_paragraph_evaluate_prompt
1285
  ):
1286
  verify_string_length(paragraph)
1287
  verify_moderation(paragraph)
1288
  verify_string_length_short(paragraph)
1289
 
1290
- if len(paragraph) > 100 and len(paragraph) < 200:
1291
- prompt_add = """
1292
- 1. 目前提交字數在100-200字之間,主題與內容的評等最高只能是B+。
1293
- 2. 請在主題與內容的回饋中加一句:「文章字數一定要超過200字,請閱讀回饋以後充實你的作文內容。」
1294
- """
1295
- else:
1296
- prompt_add = ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1297
 
1298
- if chinese_assignment_topic != "":
1299
- assignment_prompt = f"""
1300
- assignment_topic: {chinese_assignment_topic}
1301
- assignment_introduction: {chinese_assignment_introduction}
1302
- assignment_description: {chinese_assignment_description}
1303
- 請根據 assignment_topic, assignment_introduction, assignment_description 來評分
1304
- 如果 paragraph 的內容與 assignment_topic, assignment_introduction, assignment_description 無關,請給予最低分,並告知原因
1305
- ---
1306
- """
1307
- else:
1308
- assignment_prompt = ""
1309
 
1310
  user_content = f"""
1311
- sys_content: {sys_content}
 
 
1312
  ---
1313
- {assignment_prompt}
1314
  paragraph is: {paragraph}
1315
  ---
1316
- {user_generate_paragraph_evaluate_prompt}
1317
- {prompt_add}
1318
  """
1319
  total_content_text, content_table = get_chinese_paragraph_evaluate_content(thread_id, model, user_content, paragraph)
1320
 
@@ -1325,42 +1394,87 @@ def get_chinese_paragraph_refine_evaluate_content(
1325
  chinese_assignment_topic,
1326
  chinese_assignment_introduction,
1327
  chinese_assignment_description,
1328
- sys_content,
1329
  paragraph_2,
1330
- user_refine_paragraph_prompt
1331
  ):
1332
  verify_string_length(paragraph_2)
1333
  verify_moderation(paragraph_2)
1334
  verify_string_length_short(paragraph_2)
1335
 
1336
- if len(paragraph_2) > 100 and len(paragraph_2) < 200:
1337
- prompt_add = """
1338
- 1. 目前提交字數在100-200字之間,主題與內容的評等最高只能是B+。
1339
- 2. 請在主題與內容的回饋中加一句:「文章字數一定要超過200字,請閱讀回饋以後充實你的作文內容。」
1340
- """
1341
- else:
1342
- prompt_add = ""
1343
-
1344
- if chinese_assignment_topic != "":
1345
- assignment_prompt = f"""
1346
- assignment_topic: {chinese_assignment_topic}
1347
- assignment_introduction: {chinese_assignment_introduction}
1348
- assignment_description: {chinese_assignment_description}
1349
- 請根據 assignment_topic, assignment_introduction, assignment_description 來評分
1350
- 如果 paragraph 的內容與 assignment_topic, assignment_introduction, assignment_description 無關,請給予最低分,並告知原因
1351
- ---
1352
- """
1353
- else:
1354
- assignment_prompt = ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1355
 
 
 
 
 
1356
  user_content = f"""
1357
- sys_content: {sys_content}
1358
  ---
1359
  {assignment_prompt}
1360
  refined paragraph is: {paragraph_2}
1361
  ---
1362
- {user_refine_paragraph_prompt}
1363
- {prompt_add}
1364
  """
1365
  total_content_text, content_table = get_chinese_paragraph_evaluate_content(thread_id, model, user_content, paragraph_2)
1366
 
@@ -3312,70 +3426,6 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3312
 
3313
  # =====中文全文批改=====
3314
  with gr.Tab("中文全文批改") as chinese_full_paragraph_tab:
3315
- with gr.Row(visible=False) as chinese_full_paragraph_params:
3316
- chinese_full_paragraph_sys_content_input = gr.Textbox(label="System Prompt", value="You are a Chinese teacher who is practicing with me to improve my Chinese writing skill.")
3317
- default_user_generate_chinese_full_paragraph_evaluate_prompt = """
3318
- # 請嚴格根據 instructions
3319
-
3320
- # Rules:
3321
- 1. 先檢查是否是合理的作文或是段落,再進行評分
3322
- 2. 請確保作文或段落的內容完整,並且符合中文語法
3323
- 3. 如果是一篇亂打的文章請直接給予回饋:「這篇文章內容不完整,無法進行評分。」
3324
- 4. 如果無法進行評分 評分標準與回饋的內容跟等級,則為 X
3325
- 5. 評分標準與回饋根據「A+、A、A- 、B+、 B、 B-」等級來評分,最低為 B-
3326
-
3327
- # Restrictions:
3328
- 1. 不用給整體評分
3329
- 2. 不用改標點符號
3330
- 3. 評分標準的分數等級請使用「A+、A、A- 、B+、 B、 B-」等級,不可使用數字或是其他等級,像是「90分、80分、C、D」等等。
3331
-
3332
- # Output format:
3333
- 1. 先給 綜合回饋、評分標準與回饋、修改範例
3334
- 2. 再將評分標準與回饋的內容以JSON格式輸出,並且請使用繁體中文(ZH-TW)來評分段落並輸出,用 ```json ..... ``` 包裹:
3335
- 3. please use Chinese language (ZH-TW) to evaluate the paragraph and output use JSON format:
3336
-
3337
- EXAMPLE:
3338
- # 綜合回饋
3339
- 你的文章...............(寫出一段話,來總結這篇作文的好壞)
3340
-
3341
- # 評分標準與回饋
3342
- 主題與內容:B+ 你的主題很明確,講述了CSS在渲染空間上的問題及解決方案,這是一個重要而實用的話題。然而,內容相對較少,缺乏足夠的細節與實例來支撐你的觀點。建議你可以添加一些具體情境或例子,讓讀者更容易理解CSS的應用情況,例如提到常見的渲染問題以及具體的解決方法。
3343
-
3344
- 段落結構:B 你的段落結構基本清晰,但目前只有一段,這使得整體文章顯得有些單薄。建議你可以將內容分成幾個小段落,每個段落著重於不同的要點,例如一段說明問題,另一段探討解決方案,這樣整體更具條理性。
3345
-
3346
- 遣詞造句:A 你的遣詞造句大致良好,用詞得體且通順。不過可以嘗試加一些更具體的技術詞彙或示例,使文章更專業化。
3347
-
3348
- # 修改範例
3349
- - 原文:內容雖然簡短,但主題明確。
3350
- - 修改:雖然內容相對簡短,但主題表達得非常明確。
3351
- - 原文:缺乏實例和具體情境來支持內容。
3352
- - 修改:目前缺少具體的實例及情境來支持文章的內容與主張。
3353
- - 原文:可以進一步擴展。
3354
- - 修改:可以進一步擴展來豐富內容,讓讀者更有共鳴。
3355
-
3356
- ```json
3357
- {{
3358
- "results": {{
3359
- "主題與內容": {{
3360
- "level": "A+",
3361
- "explanation": "#中文解釋 ZH-TW"
3362
- }},
3363
- "段落結構": {{
3364
- "level": "B+",
3365
- "explanation": "#中文解釋 ZH-TW"
3366
- }},
3367
- "遣詞造句": {{
3368
- "level": "C",
3369
- "explanation": "#中文解釋 ZH-TW"
3370
- }}
3371
- }}
3372
- }}
3373
- ```
3374
-
3375
- Restrictions:
3376
- - ALL the content should be in Traditional Chinese (zh-TW), it's very important.
3377
- """
3378
- user_generate_chinese_full_paragraph_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_chinese_full_paragraph_evaluate_prompt)
3379
  with gr.Row():
3380
  gr.Markdown("# 輸入段落全文")
3381
  with gr.Row():
@@ -3392,71 +3442,6 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3392
  # 修改文章
3393
  with gr.Row():
3394
  gr.Markdown("# 根據建議修改文章")
3395
- with gr.Row(visible=False) as chinese_full_paragraph_refine_params:
3396
- default_user_generate_chinese_full_paragraph_refine_evaluate_prompt = """
3397
- # 請嚴格根據 instructions
3398
- # Rules:
3399
- 1. 我給你兩篇文章,請進行比較跟批改,並給出建議,如果文章完全一樣,請給出回饋:「這兩篇文章內容完全一樣,無法進行評分。」,後續評分給予 level X,仍要輸出 JSON
3400
- 2. 先檢查是否是合理的作文或是段落,再進行評分
3401
- 2. 請確保作文或段落的內容完整,並且符合中文語法
3402
- 3. 如果是一篇亂打的文章請直接給予回饋:「這篇文章內容不完整,無法進行評分。」
3403
- 4. 如果無法進行評分 評分標準與回饋的內容跟等級,則為 X
3404
- 5. 針對修改後的評分標準與回饋根據「A+、A、A- 、B+、 B、 B-」等級來評分,最低為 B-
3405
-
3406
- # Restrictions:
3407
- 1. 不用給整體評分
3408
- 2. 不用改標點符號
3409
- 3. 評分標準的分數等級請使用「A+、A、A- 、B+、 B、 B-」等級,不可使用數字或是其他等級,像是「90分、80分、C、D」等等。
3410
- 4. 回傳的 output json 不需要有原文的評分,只需要有修改後的評分
3411
-
3412
- # Output format:
3413
- 1. 先給 綜合回饋、評分標準與回饋、修改範例
3414
- 2. 再將評分標準與回饋的內容以JSON格式輸出,並且請使用繁體中文(ZH-TW)來評分段落並輸出,用 ```json ..... ``` 包裹:
3415
- 3. please use Chinese language (ZH-TW) to evaluate the paragraph and output use JSON format:
3416
- 4. if the score is X, please still follow the format and give the key as level and value as 'X'. then give the explanation in Chinese
3417
-
3418
- EXAMPLE:
3419
- # 綜合回饋(前後比較)
3420
- 你的文章...............(寫出一段話,比較兩篇作文的差異)
3421
-
3422
- # 評分標準與回饋
3423
- 主題與內容:B+ 你的主題很明確,講述了CSS在渲染空間上的問題及解決方案,這是一個重要而實用的話題。然而,內容相對較少,缺乏足夠的細節與實例來支撐你的觀點。建議你可以添加一些具體情境或例子,讓讀者更容易理解CSS的應用情況,例如提到常見的渲染問題以及具體的解決方法。
3424
-
3425
- 段落結構:B 你的段落結構基本清晰,但目前只有一段,這使得整體文章顯得有些單薄。建議你可以將內容分成幾個小段落,每個段落著重於不同的要點,例如一段說明問題,另一段探討解決方案,這樣整體更具條理性。
3426
-
3427
- 遣詞造句:A 你的遣詞造句大致良好,用詞得體且通順。不過可以嘗試加一些更具體的技術詞彙或示例,使文章更專業化。
3428
-
3429
- # 修改範例
3430
- - 原文:內容雖然簡短,但主題明確。
3431
- - 修改:雖然內容相對簡短,但主題表達得非常明確。
3432
- - 原文:缺乏實例和具體情境來支持內容。
3433
- - 修改:目前缺少具體的實例及情境來支持文章的內容與主張。
3434
- - 原文:可以進一步擴展。
3435
- - 修改:可以進一步擴展來豐富內容,讓讀者更有共鳴。
3436
-
3437
- ```json
3438
- {{
3439
- "results": {{
3440
- "主題與內容": {{
3441
- "level": "A+",
3442
- "explanation": "#中文解釋 ZH-TW"
3443
- }},
3444
- "段落結構": {{
3445
- "level": "B+",
3446
- "explanation": "#中文解釋 ZH-TW"
3447
- }},
3448
- "遣詞造句": {{
3449
- "level": "C",
3450
- "explanation": "#中文解釋 ZH-TW"
3451
- }}
3452
- }}
3453
- }}
3454
- ```
3455
-
3456
- Restrictions:
3457
- - ALL the content should be in Traditional Chinese (zh-TW), it's very important.
3458
- """
3459
- user_generate_chinese_full_paragraph_refine_evaluate_prompt = gr.Textbox(label="Paragraph evaluate Prompt", value=default_user_generate_chinese_full_paragraph_refine_evaluate_prompt)
3460
  with gr.Row():
3461
  with gr.Column():
3462
  chinese_full_paragraph_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考建議,你可以選擇是否修改:", show_copy_button=True)
@@ -3540,6 +3525,12 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3540
  )
3541
 
3542
  chinese_full_paragraph_evaluate_button.click(
 
 
 
 
 
 
3543
  fn=get_chinese_conversation_thread_id,
3544
  inputs=[chinese_thread_id_state],
3545
  outputs=[chinese_thread_id_state]
@@ -3551,9 +3542,7 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3551
  chinese_assignment_topic,
3552
  chinese_assignment_introduction,
3553
  chinese_assignment_description,
3554
- chinese_full_paragraph_sys_content_input,
3555
  chinese_full_paragraph_input,
3556
- user_generate_chinese_full_paragraph_evaluate_prompt
3557
  ],
3558
  outputs=[
3559
  chinese_full_paragraph_evaluate_output_text,
@@ -3563,9 +3552,19 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3563
  fn=duplicate_element,
3564
  inputs=[chinese_full_paragraph_input],
3565
  outputs=chinese_full_paragraph_refine_input
 
 
 
 
3566
  )
3567
 
3568
  generate_chinese_full_paragraph_refine_button.click(
 
 
 
 
 
 
3569
  fn=get_chinese_conversation_thread_id,
3570
  inputs=[chinese_thread_id_state],
3571
  outputs=[chinese_thread_id_state]
@@ -3577,11 +3576,12 @@ with gr.Blocks(theme=THEME, css=CSS) as demo:
3577
  chinese_assignment_topic,
3578
  chinese_assignment_introduction,
3579
  chinese_assignment_description,
3580
- chinese_full_paragraph_sys_content_input,
3581
- chinese_full_paragraph_refine_input,
3582
- user_generate_chinese_full_paragraph_refine_evaluate_prompt
3583
- ],
3584
  outputs=[chinese_full_paragraph_refine_output_text, chinese_full_paragraph_refine_output_table]
 
 
 
 
3585
  )
3586
 
3587
  chinese_full_paragraph_save_button.click(
 
1167
 
1168
  return is_flagged, response_dict
1169
 
1170
+ def generate_size_count_prompt(paragraph):
1171
+ if len(paragraph) > 100 and len(paragraph) < 200:
1172
+ size_count_prompt = """
1173
+ # Restrictions:
1174
+ 1. 目前提交字數在100-200字之間,主題與內容的評等最高只能是B+。
1175
+ 2. 請在主題與內容的回饋中加一句:「文章字數一定要超過200字,請閱讀回饋以後充實你的作文內容。」
1176
+ """
1177
+ else:
1178
+ size_count_prompt = ""
1179
+
1180
+ return size_count_prompt
1181
+
1182
+ def generate_assignment_prompt(chinese_assignment_topic, chinese_assignment_introduction, chinese_assignment_description):
1183
+ if chinese_assignment_topic != "":
1184
+ assignment_prompt = f"""
1185
+ assignment_topic: {chinese_assignment_topic}
1186
+ assignment_introduction: {chinese_assignment_introduction}
1187
+ assignment_description: {chinese_assignment_description}
1188
+ 請根據 assignment_topic, assignment_introduction, assignment_description 來評分
1189
+ 如果 paragraph 的內容與 assignment_topic, assignment_introduction, assignment_description 無關,請給予最低分,並告知原因
1190
+ """
1191
+ else:
1192
+ assignment_prompt = ""
1193
+
1194
+ return assignment_prompt
1195
+
1196
  def assign_grade(subject_content, structure, diction, spelling_punctuation):
1197
  # 定義等級順序
1198
  grade_order = ["A+", "A", "A-", "B+", "B", "B-"]
 
1298
 
1299
  return total_content_text, content_table
1300
 
 
1301
  def get_chinese_paragraph_1st_evaluate_content(
1302
  thread_id,
1303
  model,
1304
  chinese_assignment_topic,
1305
  chinese_assignment_introduction,
1306
  chinese_assignment_description,
 
1307
  paragraph,
 
1308
  ):
1309
  verify_string_length(paragraph)
1310
  verify_moderation(paragraph)
1311
  verify_string_length_short(paragraph)
1312
 
1313
+ size_count_prompt = generate_size_count_prompt(paragraph)
1314
+ assignment_prompt = generate_assignment_prompt(chinese_assignment_topic, chinese_assignment_introduction, chinese_assignment_description)
1315
+ sys_content_prompt = "You are a Chinese teacher who is practicing with me to improve my Chinese writing skill."
1316
+
1317
+ paragraph_evaluate_prompt = """
1318
+ # 請嚴格根據 instructions
1319
+ # Rules:
1320
+ 1. 先檢查是否是合理的作文或是段落,再進行評分
1321
+ 2. 請確保作文或段落的內容完整,並且符合中文語法
1322
+ 3. 如果是一篇亂打的文章請直接給予回饋:「這篇文章內容不完整,無法進行評分。」
1323
+ 4. 如果無法進行評分 評分標準與回饋的內容跟等級,則為 X
1324
+ 5. 評分標準與回饋根據「A+、A、A- 、B+、 B、 B-」等級來評分,最低為 B-
1325
+
1326
+ # Restrictions:
1327
+ 1. 不用給整體評分
1328
+ 2. 不用改標點符號
1329
+ 3. 評分標準的分數等級請使用「A+、A、A- 、B+、 B、 B-」等級,不可使用數字或是其他等級,像是「90分、80分、C、D」等等。
1330
+
1331
+ # Output format:
1332
+ 1. 先給 綜合回饋、評分標準與回饋、修改範例
1333
+ 2. 再將評分標準與回饋的內容以JSON格式輸出,並且請使用繁體中文(ZH-TW)來評分段落並輸出,用 ```json ..... ``` 包裹:
1334
+ 3. please use Chinese language (ZH-TW) to evaluate the paragraph and output use JSON format:
1335
+
1336
+ EXAMPLE:
1337
+ # 綜合回饋
1338
+ 你的文章...............(寫出一段話,來總結這篇作文的好壞)
1339
+
1340
+ # 評分標準與回饋
1341
+ 主題與內容:B+ 你的主題很明確,講述了CSS在渲染空間上的問題及解決方案,這是一個重要而實用的話題。然而,內容相對較少,缺乏足夠的細節與實例來支撐你的觀點。建議你可以添加一些具體情境或例子,讓讀者更容易理解CSS的應用情況,例如提到常見的渲染問題以及具體的解決方法。
1342
+
1343
+ 段落結構:B 你的段落結構基本清晰,但目前只有一段,這使得整體文章顯得有些單薄。建議你可以將內容分成幾個小段落,每個段落著重於不同的要點,例如一段說明問題,另一段探討解決方案,這樣整體更具條理性。
1344
+
1345
+ 遣詞造句:A 你的遣詞造句大致良好,用詞得體且通順。不過可以嘗試加一些更具體的技術詞彙或示例,使文章更專業化。
1346
+
1347
+ # 修改範例
1348
+ - 原文:內容雖然簡短,但主題明確。
1349
+ - 修改:雖然內容相對簡短,但主題表達得非常明確。
1350
+ - 原文:缺乏實例和具體情境來支持內容。
1351
+ - 修改:目前缺少具體的實例及情境來支持文章的內容與主張。
1352
+ - 原文:可以進一步擴展。
1353
+ - 修改:可以進一步擴展來豐富內容,讓讀者更有共鳴。
1354
+
1355
+ ```json
1356
+ {{
1357
+ "results": {{
1358
+ "主題與內容": {{
1359
+ "level": "A+",
1360
+ "explanation": "#中文解釋 ZH-TW"
1361
+ }},
1362
+ "段落結構": {{
1363
+ "level": "B+",
1364
+ "explanation": "#中文解釋 ZH-TW"
1365
+ }},
1366
+ "遣詞造句": {{
1367
+ "level": "C",
1368
+ "explanation": "#中文解釋 ZH-TW"
1369
+ }}
1370
+ }}
1371
+ }}
1372
+ ```
1373
 
1374
+ Restrictions:
1375
+ - ALL the content should be in Traditional Chinese (zh-TW), it's very important.
1376
+ """
 
 
 
 
 
 
 
 
1377
 
1378
  user_content = f"""
1379
+ sys_content: {sys_content_prompt}
1380
+ ---
1381
+ assignment_prompt: {assignment_prompt}
1382
  ---
 
1383
  paragraph is: {paragraph}
1384
  ---
1385
+ paragraph_evaluate_prompt: {paragraph_evaluate_prompt}
1386
+ size_count_prompt: {size_count_prompt}
1387
  """
1388
  total_content_text, content_table = get_chinese_paragraph_evaluate_content(thread_id, model, user_content, paragraph)
1389
 
 
1394
  chinese_assignment_topic,
1395
  chinese_assignment_introduction,
1396
  chinese_assignment_description,
 
1397
  paragraph_2,
 
1398
  ):
1399
  verify_string_length(paragraph_2)
1400
  verify_moderation(paragraph_2)
1401
  verify_string_length_short(paragraph_2)
1402
 
1403
+ size_count_prompt = generate_size_count_prompt(paragraph_2)
1404
+ assignment_prompt = generate_assignment_prompt(chinese_assignment_topic, chinese_assignment_introduction, chinese_assignment_description)
1405
+ sys_content_prompt = "You are a Chinese teacher who is practicing with me to improve my Chinese writing skill."
1406
+ paragraph_evaluate_prompt = f"""
1407
+ # 請嚴格根據 instructions
1408
+ # Rules:
1409
+ 1. 我給你兩篇文章,請進行比較跟批改,並給出建議,如果文章完全一樣,請給出回饋:「這兩篇文章內容完全一樣,無法進行評分。」,後續評分給予 level X,仍要輸出 JSON
1410
+ 2. 先檢查是否是合理的作文或是段落,再進行評分
1411
+ 2. 請確保作文或段落的內容完整,並且符合中文語法
1412
+ 3. 如果是一篇亂打的文章請直接給予回饋:「這篇文章內容不完整,無法進行評分。」
1413
+ 4. 如果無法進行評分 評分標準與回饋的內容跟等級,則為 X
1414
+ 5. 針對修改後的評分標準與回饋根據「A+、A、A- 、B+、 B、 B-」等級來評分,最低為 B-
1415
+
1416
+ # Restrictions:
1417
+ 1. 不用給整體評分
1418
+ 2. 不用改標點符號
1419
+ 3. 評分標準的分數等級請使用「A+、A、A- 、B+、 B、 B-」等級,不可使用數字或是其他等級,像是「90分、80分、C、D」等等。
1420
+ 4. 回傳的 output json 不需要有原文的評分,只���要有修改後的評分
1421
+
1422
+ # Output format:
1423
+ 1. 先給 綜合回饋、評分標準與回饋、修改範例
1424
+ 2. 再將評分標準與回饋的內容以JSON格式輸出,並且請使用繁體中文(ZH-TW)來評分段落並輸出,用 ```json ..... ``` 包裹:
1425
+ 3. please use Chinese language (ZH-TW) to evaluate the paragraph and output use JSON format:
1426
+ 4. if the score is X, please still follow the format and give the key as level and value as 'X'. then give the explanation in Chinese
1427
+
1428
+ EXAMPLE:
1429
+ # 綜合回饋(前後比較)
1430
+ 你的文章...............(寫出一段話,比較兩篇作文的差異)
1431
+
1432
+ # 評分標準與回饋
1433
+ 主題與內容:B+ 你的主題很明確,講述了CSS在渲染空間上的問題及解決方案,這是一個重要而實用的話題。然而,內容相對較少,缺乏足夠的細節與實例來支撐你的觀點。建議你可以添加一些具體情境或例子,讓讀者更容易理解CSS的應用情況,例如提到常見的渲染問題以及具體的解決方法。
1434
+
1435
+ 段落結構:B 你的段落結構基本清晰,但目前只有一段,這使得整體文章顯得有些單薄。建議你可以將內容分成幾個小段落,每個段落著重於不同的要點,例如一段說明問題,另一段探討解決方案,這樣整體更具條理性。
1436
+
1437
+ 遣詞造句:A 你的遣詞造句大致良好,用詞得體且通順。不過可以嘗試加一些更具體的技術詞彙或示例,使文章更專業化。
1438
+
1439
+ # 修改範例
1440
+ - 原文:內容雖然簡短,但主題明確。
1441
+ - 修改:雖然內容相對簡短,但主題表達得非常明確。
1442
+ - 原文:缺乏實例和具體情境來支持內容。
1443
+ - 修改:目前缺少具體的實例及情境來支持文章的內容與主張。
1444
+ - 原文:可以進一步擴展。
1445
+ - 修改:可以進一步擴展來豐富內容,讓讀者更有共鳴。
1446
+
1447
+ ```json
1448
+ {{
1449
+ "results": {{
1450
+ "主題與內容": {{
1451
+ "level": "A+",
1452
+ "explanation": "#中文解釋 ZH-TW"
1453
+ }},
1454
+ "段落結構": {{
1455
+ "level": "B+",
1456
+ "explanation": "#中文解釋 ZH-TW"
1457
+ }},
1458
+ "遣詞造句": {{
1459
+ "level": "C",
1460
+ "explanation": "#中文解釋 ZH-TW"
1461
+ }}
1462
+ }}
1463
+ }}
1464
+ ```
1465
 
1466
+ Restrictions:
1467
+ - ALL the content should be in Traditional Chinese (zh-TW), it's very important.
1468
+ """
1469
+
1470
  user_content = f"""
1471
+ sys_content: {sys_content_prompt}
1472
  ---
1473
  {assignment_prompt}
1474
  refined paragraph is: {paragraph_2}
1475
  ---
1476
+ paragraph_evaluate_prompt: {paragraph_evaluate_prompt}
1477
+ size_count_prompt: {size_count_prompt}
1478
  """
1479
  total_content_text, content_table = get_chinese_paragraph_evaluate_content(thread_id, model, user_content, paragraph_2)
1480
 
 
3426
 
3427
  # =====中文全文批改=====
3428
  with gr.Tab("中文全文批改") as chinese_full_paragraph_tab:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3429
  with gr.Row():
3430
  gr.Markdown("# 輸入段落全文")
3431
  with gr.Row():
 
3442
  # 修改文章
3443
  with gr.Row():
3444
  gr.Markdown("# 根據建議修改文章")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3445
  with gr.Row():
3446
  with gr.Column():
3447
  chinese_full_paragraph_refine_input = gr.TextArea(label="這是你的原始寫作內容,參考建議,你可以選擇是否修改:", show_copy_button=True)
 
3525
  )
3526
 
3527
  chinese_full_paragraph_evaluate_button.click(
3528
+ fn=disable_elements,
3529
+ inputs=[],
3530
+ outputs=[
3531
+ chinese_full_paragraph_evaluate_button
3532
+ ]
3533
+ ).then(
3534
  fn=get_chinese_conversation_thread_id,
3535
  inputs=[chinese_thread_id_state],
3536
  outputs=[chinese_thread_id_state]
 
3542
  chinese_assignment_topic,
3543
  chinese_assignment_introduction,
3544
  chinese_assignment_description,
 
3545
  chinese_full_paragraph_input,
 
3546
  ],
3547
  outputs=[
3548
  chinese_full_paragraph_evaluate_output_text,
 
3552
  fn=duplicate_element,
3553
  inputs=[chinese_full_paragraph_input],
3554
  outputs=chinese_full_paragraph_refine_input
3555
+ ).then(
3556
+ fn=enable_elements,
3557
+ inputs=[],
3558
+ outputs=[chinese_full_paragraph_evaluate_button]
3559
  )
3560
 
3561
  generate_chinese_full_paragraph_refine_button.click(
3562
+ fn=disable_elements,
3563
+ inputs=[],
3564
+ outputs=[
3565
+ generate_chinese_full_paragraph_refine_button
3566
+ ]
3567
+ ).then(
3568
  fn=get_chinese_conversation_thread_id,
3569
  inputs=[chinese_thread_id_state],
3570
  outputs=[chinese_thread_id_state]
 
3576
  chinese_assignment_topic,
3577
  chinese_assignment_introduction,
3578
  chinese_assignment_description,
3579
+ chinese_full_paragraph_refine_input, ],
 
 
 
3580
  outputs=[chinese_full_paragraph_refine_output_text, chinese_full_paragraph_refine_output_table]
3581
+ ).then(
3582
+ fn=enable_elements,
3583
+ inputs=[],
3584
+ outputs=[generate_chinese_full_paragraph_refine_button]
3585
  )
3586
 
3587
  chinese_full_paragraph_save_button.click(