mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
removed unnecessary check
This commit is contained in:
parent
f660af121e
commit
7f3ddff163
1 changed files with 13 additions and 14 deletions
|
|
@ -340,20 +340,19 @@ class SubprocessCLITransport(Transport):
|
|||
try:
|
||||
sp_idx = cmd.index("--system-prompt")
|
||||
sp_value = cmd[sp_idx + 1]
|
||||
if len(sp_value) > _CMD_LENGTH_LIMIT // 2:
|
||||
temp_file = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".txt", delete=False, encoding="utf-8"
|
||||
)
|
||||
temp_file.write(sp_value)
|
||||
temp_file.close()
|
||||
self._temp_files.append(temp_file.name)
|
||||
# Replace --system-prompt with --system-prompt-file
|
||||
cmd[sp_idx] = "--system-prompt-file"
|
||||
cmd[sp_idx + 1] = temp_file.name
|
||||
logger.info(
|
||||
f"System prompt length ({len(sp_value)}) exceeds limit. "
|
||||
f"Using --system-prompt-file: {temp_file.name}"
|
||||
)
|
||||
temp_file = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".txt", delete=False, encoding="utf-8"
|
||||
)
|
||||
temp_file.write(sp_value)
|
||||
temp_file.close()
|
||||
self._temp_files.append(temp_file.name)
|
||||
# Replace --system-prompt with --system-prompt-file
|
||||
cmd[sp_idx] = "--system-prompt-file"
|
||||
cmd[sp_idx + 1] = temp_file.name
|
||||
logger.info(
|
||||
f"System prompt length ({len(sp_value)}) exceeds limit. "
|
||||
f"Using --system-prompt-file: {temp_file.name}"
|
||||
)
|
||||
except (ValueError, IndexError) as e:
|
||||
logger.warning(f"Failed to optimize system prompt length: {e}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue