Song commited on
Commit ·
04a323f
1
Parent(s): b88006b
hi
Browse files- app.py +1 -1
- src/ai_engine.py +2 -2
app.py
CHANGED
|
@@ -177,7 +177,7 @@ elif active_tab == 'AI Report':
|
|
| 177 |
with col_lang:
|
| 178 |
report_lang = st.selectbox('Language / 報告語言', ['Chinese', 'English', 'Japanese'], key='lang_select')
|
| 179 |
with col_depth:
|
| 180 |
-
report_depth = st.selectbox('Report Depth / 報告深度', ['Short (300 words)', 'Standard (800 words)', 'Detailed (1500 words)'], index=
|
| 181 |
depth_map = {'Short (300 words)': 300, 'Standard (800 words)': 800, 'Detailed (1500 words)': 1500}
|
| 182 |
selected_length = depth_map[report_depth]
|
| 183 |
|
|
|
|
| 177 |
with col_lang:
|
| 178 |
report_lang = st.selectbox('Language / 報告語言', ['Chinese', 'English', 'Japanese'], key='lang_select')
|
| 179 |
with col_depth:
|
| 180 |
+
report_depth = st.selectbox('Report Depth / 報告深度', ['Short (300 words)', 'Standard (800 words)', 'Detailed (1500 words)'], index=2, key='depth_select')
|
| 181 |
depth_map = {'Short (300 words)': 300, 'Standard (800 words)': 800, 'Detailed (1500 words)': 1500}
|
| 182 |
selected_length = depth_map[report_depth]
|
| 183 |
|
src/ai_engine.py
CHANGED
|
@@ -576,8 +576,8 @@ class EnhancedAIReportEngine:
|
|
| 576 |
return self._generate_mock_report(system_prompt, user_prompt, meta)
|
| 577 |
|
| 578 |
# 動態調整 max_tokens,根據目標長度給予足夠空間(中文字符與 token 比例約 1:2.5 - 3)
|
| 579 |
-
# 給予
|
| 580 |
-
dynamic_max_tokens = min(
|
| 581 |
|
| 582 |
response = self.client.chat.completions.create(
|
| 583 |
model=self.model,
|
|
|
|
| 576 |
return self._generate_mock_report(system_prompt, user_prompt, meta)
|
| 577 |
|
| 578 |
# 動態調整 max_tokens,根據目標長度給予足夠空間(中文字符與 token 比例約 1:2.5 - 3)
|
| 579 |
+
# 給予更加寬鬆的空間(倍數從 4 提高到 6-8),確保報告不被截斷
|
| 580 |
+
dynamic_max_tokens = min(16384, max(4096, meta.length.value * 6))
|
| 581 |
|
| 582 |
response = self.client.chat.completions.create(
|
| 583 |
model=self.model,
|