Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
congminh1254 committed Jul 31, 2024
1 parent d77e1a3 commit 19d5d33
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
8 changes: 1 addition & 7 deletions docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?"
```
Expand Down
10 changes: 1 addition & 9 deletions src/commands/ai/ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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',
Expand Down
4 changes: 0 additions & 4 deletions test/commands/ai.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
])
Expand All @@ -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(
Expand Down

0 comments on commit 19d5d33

Please sign in to comment.