From 19d5d33ee9ba09f76132993c2c6fe93fa5053485 Mon Sep 17 00:00:00 2001 From: Minh Nguyen Cong Date: Wed, 31 Jul 2024 13:51:29 +0200 Subject: [PATCH] Update code --- docs/ai.md | 8 +------- src/commands/ai/ask.js | 10 +--------- test/commands/ai.test.js | 4 ---- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/docs/ai.md b/docs/ai.md index f46e13db..f6b87ac4 100644 --- a/docs/ai.md +++ b/docs/ai.md @@ -27,14 +27,8 @@ OPTIONS --fields=fields Comma separated list of fields to show --items=items (required) The items for the AI request --json Output formatted JSON - - --mode=mode The mode of the AI request, should be 'single_item_qa' for one item or - 'multi_item_qa' for multiple items - --no-color Turn off colors for logging - --prompt=prompt (required) The prompt for the AI request - --save-to-file-path=save-to-file-path Override default file path to save report EXAMPLE @@ -76,7 +70,7 @@ OPTIONS --save-to-file-path=save-to-file-path Override default file path to save report EXAMPLE - box ai:text-gen --dialogue_history=prompt="What is the status of this document?",answer="It is in + box ai:text-gen --dialogue-history=prompt="What is the status of this document?",answer="It is in review",created-at="2024-07-09T11:29:46.835Z" --items=id=12345,type=file --prompt="What is the status of this document?" ``` diff --git a/src/commands/ai/ask.js b/src/commands/ai/ask.js index cd3bf199..874f76c4 100644 --- a/src/commands/ai/ask.js +++ b/src/commands/ai/ask.js @@ -8,12 +8,8 @@ class AiAskCommand extends BoxCommand { async run() { const { flags, args } = this.parse(AiAskCommand); let options = {}; + options.mode = flags.items.length > 1 ? 'multi_item_qa' : 'single_item_qa'; - if (flags.mode) { - options.mode = flags.mode; - } else { - options.mode = flags.items.length > 1 ? 'multi_item_qa' : 'single_item_qa'; - } if (flags.prompt) { options.prompt = flags.prompt; } @@ -36,10 +32,6 @@ AiAskCommand._endpoint = 'post_ai_ask'; AiAskCommand.flags = { ...BoxCommand.flags, - mode: flags.string({ - required: false, - description: 'The mode of the AI request, should be \'single_item_qa\' for one item or \'multi_item_qa\' for multiple items', - }), prompt: flags.string({ required: true, description: 'The prompt for the AI request', diff --git a/test/commands/ai.test.js b/test/commands/ai.test.js index 2f0708ed..7dcca14c 100644 --- a/test/commands/ai.test.js +++ b/test/commands/ai.test.js @@ -38,8 +38,6 @@ describe('AI', () => { '--items=content=one,two,three,id=12345,type=file', '--prompt', 'What is the status of this document?', - '--mode', - 'single_item_qa', '--json', '--token=test', ]) @@ -62,8 +60,6 @@ describe('AI', () => { '--items=content=one,two,three,id=12345,type=file', '--prompt', 'What is the status of this document?', - '--mode', - 'single_item_qa', '--token=test', ]) .it(