mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
Merge branch 'main' into feat/multimodal-input-support
This commit is contained in:
commit
2ec3ec2c38
159 changed files with 4391 additions and 3303 deletions
|
|
@ -8,6 +8,8 @@ import * as fs from 'node:fs/promises';
|
|||
import * as path from 'node:path';
|
||||
import { execCommand } from '@qwen-code/qwen-code-core';
|
||||
|
||||
const MACOS_CLIPBOARD_TIMEOUT_MS = 1500;
|
||||
|
||||
/**
|
||||
* Checks if the system clipboard contains an image (macOS only for now)
|
||||
* @returns true if clipboard contains an image
|
||||
|
|
@ -19,7 +21,13 @@ export async function clipboardHasImage(): Promise<boolean> {
|
|||
|
||||
try {
|
||||
// Use osascript to check clipboard type
|
||||
const { stdout } = await execCommand('osascript', ['-e', 'clipboard info']);
|
||||
const { stdout } = await execCommand(
|
||||
'osascript',
|
||||
['-e', 'clipboard info'],
|
||||
{
|
||||
timeout: MACOS_CLIPBOARD_TIMEOUT_MS,
|
||||
},
|
||||
);
|
||||
const imageRegex =
|
||||
/«class PNGf»|TIFF picture|JPEG picture|GIF picture|«class JPEG»|«class TIFF»/;
|
||||
return imageRegex.test(stdout);
|
||||
|
|
@ -80,7 +88,9 @@ export async function saveClipboardImage(
|
|||
end try
|
||||
`;
|
||||
|
||||
const { stdout } = await execCommand('osascript', ['-e', script]);
|
||||
const { stdout } = await execCommand('osascript', ['-e', script], {
|
||||
timeout: MACOS_CLIPBOARD_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
if (stdout.trim() === 'success') {
|
||||
// Verify the file was created and has content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue