travel-agent-cli 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/python/main.py +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "travel-agent-cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "AI 驱动的旅行目的地推荐 Agent - 命令行工具(集成 FlyAI 旅行搜索)",
5
5
  "bin": {
6
6
  "travel-agent": "bin/cli.js",
package/python/main.py CHANGED
@@ -477,11 +477,15 @@ def _switch_model(settings, provider: str, model_name: Optional[str]):
477
477
 
478
478
  def _update_model_config(provider: str, model_name: Optional[str]):
479
479
  """更新模型配置"""
480
- env_path = Path(".env")
480
+ env_path = Path.home() / ".env"
481
481
  if not env_path.exists():
482
482
  console.print("[yellow].env 文件不存在,正在创建...[/yellow]")
483
- import shutil
484
- shutil.copy(".env.example", env_path)
483
+ _init_config()
484
+
485
+ # 重新读取配置(如果刚创建)
486
+ if not env_path.exists():
487
+ console.print("[red]错误:无法创建 .env 文件[/red]")
488
+ return
485
489
 
486
490
  config_lines = []
487
491
  with open(env_path, "r") as f: