travel-agent-cli 0.4.4 → 0.4.6

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/interactive.jsx +8 -2
  2. package/package.json +1 -1
package/interactive.jsx CHANGED
@@ -7,7 +7,7 @@ import React, { useState, useEffect } from 'react';
7
7
  import { render, Box, Text, useApp, useInput } from 'ink';
8
8
  import TextInput from 'ink-text-input';
9
9
  import chalk from 'chalk';
10
- import { spawn } from 'child_process';
10
+ import { spawn, execSync } from 'child_process';
11
11
  import path from 'path';
12
12
  import { fileURLToPath } from 'url';
13
13
 
@@ -31,7 +31,6 @@ const commands = [
31
31
 
32
32
  // 查找 Python 命令
33
33
  function findPython() {
34
- const { execSync } = require('child_process');
35
34
  const candidates = ['python3', 'python'];
36
35
 
37
36
  for (const cmd of candidates) {
@@ -53,8 +52,11 @@ const runPythonCommand = (cmd, args) => {
53
52
  let error = '';
54
53
 
55
54
  const pythonCmd = findPython();
55
+
56
+ // 使用 shell 启动,让系统查找命令
56
57
  const proc = spawn(pythonCmd, [mainPy, cmd, ...args], {
57
58
  cwd: pythonDir,
59
+ shell: true,
58
60
  });
59
61
 
60
62
  proc.stdout.on('data', (data) => {
@@ -72,6 +74,10 @@ const runPythonCommand = (cmd, args) => {
72
74
  reject(error.trim() || '命令执行失败');
73
75
  }
74
76
  });
77
+
78
+ proc.on('error', (err) => {
79
+ reject(`无法启动 Python: ${err.message}`);
80
+ });
75
81
  });
76
82
  };
77
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "travel-agent-cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "AI 驱动的旅行目的地推荐 Agent - 命令行工具(集成 FlyAI 旅行搜索)",
5
5
  "type": "module",
6
6
  "bin": {