@fivetu53/soul-chat 1.0.0 → 1.0.1

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/bin/index.js +7 -3
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -98,7 +98,11 @@ const showCursor = () => process.stdout.write('\x1b[?25h');
98
98
 
99
99
  // 获取剪贴板图片 (跨平台)
100
100
  function getClipboardImage() {
101
- const tmpFile = process.platform === 'win32' ? 'C:\\Temp\\soul_clipboard.png' : '/tmp/soul_clipboard.png';
101
+ const os = require('os');
102
+ const tmpDir = os.tmpdir();
103
+ const tmpFile = process.platform === 'win32'
104
+ ? `${tmpDir}\\soul_clipboard.png`
105
+ : `${tmpDir}/soul_clipboard.png`;
102
106
 
103
107
  try {
104
108
  if (process.platform === 'darwin') {
@@ -117,8 +121,8 @@ end try`;
117
121
  if (result !== 'ok') return null;
118
122
  } else if (process.platform === 'win32') {
119
123
  // Windows: 用 PowerShell 导出剪贴板图片
120
- const ps = `$img = Get-Clipboard -Format Image; if ($img) { $img.Save('${tmpFile}'); 'ok' } else { 'no' }`;
121
- const result = execSync(`powershell -Command "${ps}"`, { encoding: 'utf8' }).trim();
124
+ const ps = `Add-Type -AssemblyName System.Windows.Forms; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $img.Save('${tmpFile.replace(/\\/g, '\\\\')}'); 'ok' } else { 'no' }`;
125
+ const result = execSync(`powershell -Command "${ps}"`, { encoding: 'utf8', windowsHide: true }).trim();
122
126
  if (result !== 'ok') return null;
123
127
  } else {
124
128
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fivetu53/soul-chat",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Soul Chat - 智能 AI 伴侣命令行客户端",
5
5
  "type": "module",
6
6
  "bin": {