feat: 新增崗位描述與清單整合功能 v2.1

主要功能更新:
- 崗位描述保存功能:保存後資料寫入資料庫
- 崗位清單自動刷新:切換模組時自動載入最新資料
- 崗位清單檢視功能:點擊「檢視」按鈕載入對應描述
- 管理者頁面擴充:新增崗位資料管理與匯出功能
- CSV 批次匯入:支援崗位與職務資料批次匯入

後端 API 新增:
- Position Description CRUD APIs
- Position List Query & Export APIs
- CSV Template Download & Import APIs

文件更新:
- SDD.md 更新至版本 2.1
- README.md 更新功能說明與版本歷史

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-04 12:46:36 +08:00
parent d17af39bf4
commit b2584772c4
31 changed files with 6795 additions and 365 deletions

90
fix_gemini_model.py Normal file
View File

@@ -0,0 +1,90 @@
"""
修正 Gemini 模型名稱和關閉按鈕
"""
# 1. 修正 llm_config.py 中的 Gemini 模型
with open('llm_config.py', 'r', encoding='utf-8') as f:
content = f.read()
# 備份
with open('llm_config.py.backup', 'w', encoding='utf-8') as f:
f.write(content)
# 替換模型名稱gemini-pro -> gemini-2.0-flash-exp
old_model = 'gemini-pro'
new_model = 'gemini-2.0-flash-exp' # 使用最新的 Gemini 2.0 Flash
content = content.replace(
f'models/{old_model}:generateContent',
f'models/{new_model}:generateContent'
)
if 'gemini-2.0-flash-exp' in content:
print(f"SUCCESS: Updated Gemini model to {new_model}")
else:
print("ERROR: Could not update model")
with open('llm_config.py', 'w', encoding='utf-8') as f:
f.write(content)
# 2. 修正 index.html 中的關閉按鈕
with open('index.html', 'r', encoding='utf-8') as f:
html_content = f.read()
# 備份
with open('index.html.backup3', 'w', encoding='utf-8') as f:
f.write(html_content)
# 找到並修正關閉按鈕
# 問題onclick 使用了複雜的選擇器,可能失效
# 解決:使用更簡單可靠的方式
old_close_button = '''<button onclick="this.closest('[style*=\\'position: fixed\\']').remove()"'''
new_close_button = '''<button onclick="closeErrorModal(this)"'''
if old_close_button in html_content:
html_content = html_content.replace(old_close_button, new_close_button)
print("SUCCESS: Updated close button onclick")
else:
print("INFO: Close button pattern not found (might be already fixed)")
# 添加 closeErrorModal 函數(如果不存在)
if 'function closeErrorModal' not in html_content:
close_modal_function = '''
// 關閉錯誤訊息對話框
function closeErrorModal(button) {
const modal = button.closest('[style*="position: fixed"]');
if (modal) {
modal.style.opacity = '0';
setTimeout(() => modal.remove(), 300);
}
}
'''
# 在 showCopyableError 函數後添加
if 'function showCopyableError' in html_content:
html_content = html_content.replace(
' // 複製錯誤訊息到剪貼板',
close_modal_function + '\n // 複製錯誤訊息到剪貼板'
)
print("SUCCESS: Added closeErrorModal function")
# 同時修正底部的確定按鈕
old_confirm_button = '''<button onclick="this.closest('[style*=\\'position: fixed\\']').remove()"'''
if old_confirm_button in html_content:
html_content = html_content.replace(old_confirm_button, new_close_button)
print("SUCCESS: Updated confirm button onclick")
with open('index.html', 'w', encoding='utf-8') as f:
f.write(html_content)
print("\nAll fixes applied!")
print("\nChanges made:")
print(f"1. Gemini model: {old_model} -> {new_model}")
print("2. Close button: Fixed onclick handler")
print("3. Added closeErrorModal function")
print("\nNext steps:")
print("1. Restart Flask server")
print("2. Reload browser page (Ctrl+F5)")
print("3. Test AI generation")