|
1 | 1 | #!/bin/bash |
2 | 2 | #set -x |
3 | 3 |
|
| 4 | +# Setting some required variables |
| 5 | +BITO_CMD=`which bito` |
| 6 | +BITO_CMD_VEP="" |
| 7 | +BITO_VERSION=`$BITO_CMD -v | awk '{print $NF}'` |
| 8 | +# Compare BITO_VERSION to check if its greater than 3.7 |
| 9 | +if awk "BEGIN {exit !($BITO_VERSION > 3.7)}"; then |
| 10 | + BITO_CMD_VEP="--agent create_overview_doc" |
| 11 | +fi |
| 12 | + |
| 13 | + |
4 | 14 | # Log file for storing the token usage information |
5 | 15 | log_file="bito_usage_log.txt" |
6 | 16 |
|
@@ -151,7 +161,7 @@ function call_bito_with_retry() { |
151 | 161 | echo "Calling bito with retry logic. Attempt $attempt of $MAX_RETRIES with prompt file '$filename'..." >&2 |
152 | 162 |
|
153 | 163 | # Call bito and capture the standard output only. |
154 | | - output=$(echo -e "$input_text" | bito -p "$prompt_file_path") |
| 164 | + output=$(echo -e "$input_text" | bito $BITO_CMD_VEP -p "$prompt_file_path") |
155 | 165 | local ret_code=$? # Capture the return code from bito. |
156 | 166 |
|
157 | 167 | # Check if the response from bito is valid using the bito_response_ok function. |
@@ -266,7 +276,7 @@ function extract_module_names_and_associated_objectives_then_call_bito() { |
266 | 276 | # Retry logic for calling bito |
267 | 277 | while [ $attempt -le $MAX_RETRIES ]; do |
268 | 278 | echo "Attempt $attempt: Running bito for module: $current_module" >&2 |
269 | | - bito_output=$(echo -e "$combined_output" | bito -p "$prompt_file_path") |
| 279 | + bito_output=$(echo -e "$combined_output" | bito $BITO_CMD_VEP -p "$prompt_file_path") |
270 | 280 | local ret_code=$? |
271 | 281 |
|
272 | 282 | if ! bito_response_ok "$ret_code" "$bito_output"; then |
@@ -304,7 +314,7 @@ function fix_mermaid_syntax() { |
304 | 314 | # Function to fix Mermaid diagram syntax using bito AI |
305 | 315 | function fix_mermaid_syntax_with_bito() { |
306 | 316 | local fixed_mermaid_content |
307 | | - fixed_mermaid_content=$(echo "$mermaid_content" | bito -p "$prompt_folder/mermaid_doc_prompt.txt" | awk '/^```mermaid$/,/^```$/{if (!/^```mermaid$/ && !/^```$/) print}') |
| 317 | + fixed_mermaid_content=$(echo "$mermaid_content" | bito $BITO_CMD_VEP -p "$prompt_folder/mermaid_doc_prompt.txt" | awk '/^```mermaid$/,/^```$/{if (!/^```mermaid$/ && !/^```$/) print}') |
308 | 318 |
|
309 | 319 | local ret_code=$? |
310 | 320 | if ! bito_response_ok "$ret_code" "$fixed_mermaid_content"; then |
@@ -396,7 +406,7 @@ function create_mermaid_diagram() { |
396 | 406 |
|
397 | 407 | while [ $attempt -le $MAX_RETRIES ]; do |
398 | 408 | echo "Attempt $attempt: Creating Mermaid diagram for module: $module_name" >&2 |
399 | | - bito_output=$(echo -e "Module: $module_name\n---\n$mermaid_definition" | bito -p "$prompt_folder/mermaid_doc_prompt.txt") |
| 409 | + bito_output=$(echo -e "Module: $module_name\n---\n$mermaid_definition" | bito $BITO_CMD_VEP -p "$prompt_folder/mermaid_doc_prompt.txt") |
400 | 410 | local ret_code=$? |
401 | 411 |
|
402 | 412 | if ! bito_response_ok "$ret_code" "$bito_output"; then |
@@ -460,7 +470,7 @@ function generate_mdd_overview() { |
460 | 470 | echo "Attempt $attempt: Processing Mermaid script for $mdd_file" >&2 |
461 | 471 | # Use bito to process the Mermaid script |
462 | 472 | temp_file=$(mktemp) |
463 | | - echo -e "$mermaid_script" | bito -p "$mermaid_doc_prompt_file" > "$temp_file" |
| 473 | + echo -e "$mermaid_script" | bito $BITO_CMD_VEP -p "$mermaid_doc_prompt_file" > "$temp_file" |
464 | 474 |
|
465 | 475 | # Validate the Mermaid script |
466 | 476 | if validate_mermaid_syntax "$(cat "$temp_file")"; then |
|
0 commit comments