Skip to content

Commit

Permalink
fixed handling of spaces in input
Browse files Browse the repository at this point in the history
  • Loading branch information
nalbion committed Feb 13, 2024
1 parent 48aef8a commit 048a490
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agent-adapters",
"version": "1.0.0",
"version": "1.0.1",
"description": "Configurable AI Agents",
"license": "MPL-2.0",
"main": "dist/index.js",
Expand Down
9 changes: 8 additions & 1 deletion src/agents/adapters/CliClientAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ export default class CliClientAgent extends Agent {

protected prepareArgs(input: AgentInputMessage, context: AgentContext): string[] {
// Send the input message as an argument to the script
const args: string[] = typeof input.content === 'string' ? [`"${input.content}"`] : [JSON.stringify(input.content)];
if (typeof input.content === 'string') {
if (input.content.includes(' ')) {
input.content = `"${input.content}"`;
}
} else {
input.content = JSON.stringify(input.content);
}
const args: string[] = [input.content];
logger.info('prepareArgs: input.content:', input.content);
logger.info('prepareArgs: args:', JSON.stringify(args));

Expand Down

0 comments on commit 048a490

Please sign in to comment.