From 4beda10b55a7ed690ffe5587e66a22ce76993511 Mon Sep 17 00:00:00 2001 From: Troys-Code Date: Mon, 4 Dec 2023 17:29:58 -0800 Subject: [PATCH 1/7] Revert Flowchart Implementation from Mermaid to code2flow - Reintroduced code2flow for flowchart generation, replacing previous Mermaid diagram implementation. - Adjusted create_module_documentation function to generate flowcharts with code2flow for individual modules. - Modified generate_flow_chart_for_system to utilize code2flow for creating a system-wide flowchart. - Removed functions and logic related to Mermaid diagram generation and validation, aligning with the shift back to code2flow. - Updated script comments and logging to reflect changes in flowchart generation methodology. - Removed Old Prompts related to Mermaid --- .../AI_Prompts/fix_mermaid_syntax_prompt.txt | 111 ---- .../AI_Prompts/mermaid_doc_prompt.txt | 1 - .../AI_Prompts/system_introduction_prompt.txt | 2 +- .../create_overview_doc/createdoc.sh | 541 +++++------------- 4 files changed, 142 insertions(+), 513 deletions(-) delete mode 100644 documentation/create_overview_doc/AI_Prompts/fix_mermaid_syntax_prompt.txt delete mode 100644 documentation/create_overview_doc/AI_Prompts/mermaid_doc_prompt.txt diff --git a/documentation/create_overview_doc/AI_Prompts/fix_mermaid_syntax_prompt.txt b/documentation/create_overview_doc/AI_Prompts/fix_mermaid_syntax_prompt.txt deleted file mode 100644 index 55d0f74..0000000 --- a/documentation/create_overview_doc/AI_Prompts/fix_mermaid_syntax_prompt.txt +++ /dev/null @@ -1,111 +0,0 @@ -# Mermaid Flowchart Syntax Cheat Sheet - -This cheat sheet provides a concise reference for the syntax used in Mermaid flowcharts. Mermaid flowcharts enable the creation of complex diagrams using simple text-based language. - -## Basic Structure - -- **Nodes**: Represented by geometric shapes. -- **Edges**: Arrows or lines connecting nodes. - -## Syntax for Nodes - -1. **Standard Node**: `id` - - ```mermaid - flowchart LR - id - ``` - -2. **Node with Text**: `id1[Text]` - - ```mermaid - flowchart LR - id1[This is text] - ``` - -3. **Node Shapes**: - - **Round Edges**: `id1(Text)` - - **Stadium Shape**: `id1([Text])` - - **Subroutine Shape**: `id1[[Text]]` - - **Cylindrical**: `id1[(Text)]` - - **Circle**: `id1((Text))` - - **Asymmetric**: `id1>This is text]` - - **Rhombus**: `id1{Text}` - - **Hexagon**: `id1{{Text}}` - - **Parallelogram**: `id1[/Text/]` - - **Alternate Parallelogram**: `id1[\Text\]` - - **Trapezoid**: `id1[/Text\]` - - **Alternate Trapezoid**: `id1[\Text/]` - - **Double Circle**: `id1(((Text)))` - -## Syntax for Edges - -1. **Standard Arrow**: `A --> B` -2. **Open Link**: `A --- B` -3. **Text on Links**: `A -- Text --> B` or `A ---|Text|B` -4. **Dotted Link**: `A -.-> B` -5. **Dotted Link with Text**: `A -. Text .-> B` -6. **Thick Link**: `A ==> B` -7. **Thick Link with Text**: `A == Text ==> B` -8. **Invisible Link**: `A ~~~ B` -9. **Chaining of Links**: `A -- text --> B -- text2 --> C` -10. **Multi Directional Arrows**: `A <--> B`, `A o--o B`, `A x--x B` - -## Special Characters and Unicode - -- Enclose troublesome characters or Unicode text in quotes: `id1["Text (with special characters)"]` - -## Subgraphs - -- Basic structure: - ``` - subgraph title - node definitions - end - ``` - -## Styling - -- **Styling Nodes and Edges**: Use `style` keyword. -- **Classes**: Define with `classDef` and apply with `class` or `:::` operator. -- **CSS Classes**: Define in HTML and apply in Mermaid. -- **Default Class**: Applies to all unstyled elements. - -## Interaction and Comments - -- **Interactive Elements**: Use `click` keyword for binding events. -- **Comments**: Preface with `%%` to ignore in rendering. - -## Configuration - -- **Renderer**: `%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%` -- **Width**: Adjust with `mermaid.flowchartConfig = { width: '100%' }` - -## Example Usage - -Given your example, here's the breakdown: - -```mermaid -flowchart LR - A[PostgresStorageConnector] -- insert --> B((Database)) - A -- get --> B - A -- delete --> B - A -- query --> B - A -- get_all --> B - C[LanceDBConnector] -- insert --> B - C -- get --> B - C -- delete --> B() - C -- query --> B - C -- get_all --> B -``` - -- `A[PostgresStorageConnector]` and `C[LanceDBConnector]`: Nodes with text. -- `B((Database))`: Circle node with text. -- `-- insert -->`: Arrow with text. -- `-- get -->`, `-- delete -->`, `-- query -->`, `-- get_all -->`: Standard arrows. - -This syntax is valid in Mermaid and will create a flowchart with nodes and directed edges as described. - -Correct the syntax errors in the following Mermaid flowchart: - -```mermaid \ No newline at end of file diff --git a/documentation/create_overview_doc/AI_Prompts/mermaid_doc_prompt.txt b/documentation/create_overview_doc/AI_Prompts/mermaid_doc_prompt.txt deleted file mode 100644 index 4186cf2..0000000 --- a/documentation/create_overview_doc/AI_Prompts/mermaid_doc_prompt.txt +++ /dev/null @@ -1 +0,0 @@ -Create a basic level-1 Data Flow Diagram (DFD) in Mermaid js syntax. Do not include parameters in function calls. \ No newline at end of file diff --git a/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt b/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt index c615e56..1276d29 100644 --- a/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt +++ b/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt @@ -1 +1 @@ -Give a brief high level system overview and its purpose using the provided context for this program, keep it detailed, concise and confident. \ No newline at end of file +Write a high level system overview and its purpose using the provided context for this program, keep it detailed, concise and confident. \ No newline at end of file diff --git a/documentation/create_overview_doc/createdoc.sh b/documentation/create_overview_doc/createdoc.sh index c399443..cd0a1ad 100755 --- a/documentation/create_overview_doc/createdoc.sh +++ b/documentation/create_overview_doc/createdoc.sh @@ -1,56 +1,27 @@ #!/bin/bash #set -x -# Log file for storing the token usage information -log_file="bito_usage_log.txt" - -# Directory containing prompt files for NLP tasks -prompt_folder="AI_Prompts" - -# Global variables for session token counts +log_file="bito_usage_log.txt" +prompt_folder="AI_Prompts" total_input_token_count=0 total_output_token_count=0 - -# CSV file with programming language extensions lang_csv="programming_languages.csv" - -# File containing skip list skip_list_csv="skip_list.csv" -# Function to check if the response from bito is valid -# Checks both the return code and the response content function bito_response_ok() { - local ret_code=$1 - local response=$2 - - # Check if return code is non-zero - if [[ $ret_code -ne 0 ]]; then - return 1 # Return non-zero status for error in return code - fi - - # Check if response starts with "Whoops" - if [[ $response == Whoops* ]]; then - return 1 # Return non-zero status for "Whoops" in response - fi - - # Check if the response is empty - if [[ -z $response ]]; then - return 1 # Return non-zero status for empty response - fi - - return 0 # Return zero status for valid response + echo "Validating response from Bito command..." >&2 + [[ $1 -ne 0 || $2 == Whoops* || -z $2 ]] && return 1 || return 0 } -# Function to update token usage function update_token_usage() { - local input_tokens=$(echo "$1" | wc -w | awk '{print int($1 * 1.34)}') - local output_tokens=$(echo "$2" | wc -w | awk '{print int($1 * 1.34)}') - total_input_token_count=$((total_input_token_count + input_tokens)) - total_output_token_count=$((total_output_token_count + output_tokens)) + echo "Updating session token counts..." >&2 + local tokens=$(echo "$1 $2" | wc -w | awk '{print int($1 * 1.34)}') + total_input_token_count=$((total_input_token_count + tokens)) + total_output_token_count=$((total_output_token_count + tokens)) } -# Function to log total token usage and session duration function log_token_usage_and_session_duration() { + echo "Finalizing session log with token usage and duration..." >&2 local duration=$(( $(date +%s) - start_time )) echo "-----------------------------------------" | tee -a "$log_file" echo "$(date "+%Y-%m-%d %H:%M:%S") - Total Token Usage for Session" | tee -a "$log_file" @@ -60,14 +31,11 @@ function log_token_usage_and_session_duration() { echo "-----------------------------------------" | tee -a "$log_file" } -# Function to check if required tools and files are present function check_tools_and_files() { - echo "Checking required tools and files for documentation generation..." >&2 - - local required_tools=("bito" "mmdc") - local required_files=("high_level_doc_prompt.txt" "mermaid_doc_prompt.txt" "system_introduction_prompt.txt" "system_overview_mermaid_update_prompt.txt" "fix_mermaid_syntax_prompt.txt") + echo "Ensuring all necessary tools and files are available..." >&2 + local required_tools=("bito") + local required_files=("high_level_doc_prompt.txt" "system_introduction_prompt.txt") - # Check for missing tools for tool in "${required_tools[@]}"; do if ! command -v "$tool" &> /dev/null; then echo -e "\nError: Tool $tool is required but not found." @@ -79,27 +47,22 @@ function check_tools_and_files() { echo " For Windows, download and install the MSI from Bito's website." echo " Follow the instructions provided by the installer." ;; - "mmdc") - echo " Install Mermaid CLI with npm: npm install -g @mermaid-js/mermaid-cli" - ;; esac exit 1 fi done - # Check for missing files for file in "${required_files[@]}"; do if [ ! -f "$prompt_folder/$file" ]; then echo -e "\nError: Missing required file: $prompt_folder/$file" exit 1 fi done - echo -e "All required tools and files are present. Proceeding...\n" >&2 } -# Function to read the skip list from the CSV file function read_skip_list() { + echo "Loading exclusion patterns from skip list..." >&2 if [ -f "$skip_list_csv" ]; then skip_list=() while IFS=, read -r skip_item; do @@ -111,419 +74,215 @@ function read_skip_list() { fi } -# Function to check if a path should be skipped based on predefined patterns function is_skippable() { - local path=$1 - - # List of directories/files to skip - local skip_dirs_files=("logs" "node_modules" "dist" "target" "bin" "package-lock.json" "data.json" "build" ".gradle" ".idea" "gradle" "extension.js" "vendor.js" "ngsw.json" "polyfills.js" "init" ".gv") + echo "Evaluating if the path $1 should be excluded..." >&2 + local path=$1 + local skip_dirs_files=("logs" "node_modules" "dist" "target" "bin" "package-lock.json" "data.json" "build" ".gradle" ".idea" "gradle" "extension.js" "vendor.js" "ngsw.json" "polyfills.js" "init" ".gv") - for skip_item in "${skip_dirs_files[@]}"; do - if [[ "$path" == *"$skip_item"* ]]; then - return 0 - fi - done + for skip_item in "${skip_dirs_files[@]}"; do + if [[ "$path" == *"$skip_item"* ]]; then + return 0 + fi + done - # Skip hidden files (files starting with a dot) - if [[ $(basename "$path") == .* ]]; then - return 0 - fi + if [[ $(basename "$path") == .* ]]; then + return 0 + fi - return 1 + return 1 } -# Function to call the bito command with retry logic. -# This function handles temporary failures by retrying the bito command a specified number of times. function call_bito_with_retry() { - local input_text=$1 # The input text to be sent to bito. - local prompt_file_path=$2 # The path to the prompt file for bito. - local attempt=1 # Initialize the attempt counter. - local output # Variable to store the output from bito. - local MAX_RETRIES=5 # Maximum number of retries. - local RETRY_DELAY=10 # Delay in seconds between retries. + echo "Initiating Bito command with retry for prompt file $2..." >&2 + local input_text=$1 prompt_file_path=$2 error_message=$3 + local attempt=1 MAX_RETRIES=5 RETRY_DELAY=10 output - # Extract the filename from the prompt file path for logging purposes. - local filename=$(basename "$prompt_file_path") - - # Loop to attempt calling bito up to MAX_RETRIES times. while [ $attempt -le $MAX_RETRIES ]; do - # Log the attempt number and the file being processed. - echo "Calling bito with retry logic. Attempt $attempt of $MAX_RETRIES with prompt file '$filename'..." >&2 - - # Call bito and capture the standard output only. + echo "Attempt $attempt: Calling Bito for prompt '$prompt_file_path'..." >&2 output=$(echo -e "$input_text" | bito -p "$prompt_file_path") - local ret_code=$? # Capture the return code from bito. + local ret_code=$? - # Check if the response from bito is valid using the bito_response_ok function. if ! bito_response_ok "$ret_code" "$output"; then - # If the response is not valid, log the error and retry after a delay. - echo "Attempt $attempt: bito call for file '$filename' completed but returned insufficient content. Retrying in $RETRY_DELAY seconds..." >&2 - sleep $RETRY_DELAY # Wait for RETRY_DELAY seconds before retrying. - ((attempt++)) # Increment the attempt counter. + echo "Attempt $attempt: $error_message Retrying in $RETRY_DELAY seconds..." >&2 + sleep $RETRY_DELAY + ((attempt++)) else - # If the response is valid, log the success, output the result, and update token usage. - echo "Attempt $attempt: Success! bito call for file '$filename' returned sufficient content." >&2 + echo "Bito call successful on attempt $attempt." >&2 echo "$output" - update_token_usage "$input_text" "$output" # Update the token usage statistics. - return 0 # Return successfully. + update_token_usage "$input_text" "$output" + return 0 fi done - # If all attempts fail, log an error message and return with an error status. - echo "All $MAX_RETRIES attempts to call bito with prompt file '$filename' have failed to return adequate content. Exiting with error." >&2 + echo "Failed to call Bito after $MAX_RETRIES attempts. $error_message" >&2 return 1 } -# Generate documentation for an individual module function create_module_documentation() { local path_to_module="$1" local documentation_directory="$2" - echo "Creating documentation for module: $path_to_module" >&2 + echo "Generating documentation for the module at $path_to_module..." >&2 if is_skippable "$path_to_module"; then echo "Skipped $path_to_module as it's on the exclusion list." return fi - + local name_of_module=$(basename "$path_to_module") local content_of_module=$(<"$path_to_module") local high_level_documentation - high_level_documentation=$(call_bito_with_retry "Module: $name_of_module\n---\n$content_of_module" "$prompt_folder/high_level_doc_prompt.txt") + high_level_documentation=$(call_bito_with_retry "Module: $name_of_module\n---\n$content_of_module" "$prompt_folder/high_level_doc_prompt.txt" "High-level documentation creation failed for module: $name_of_module") local ret_code=$? if ! bito_response_ok "$ret_code" "$high_level_documentation"; then echo "High-level documentation creation failed for module: $name_of_module" return 1 fi - update_token_usage "$content_of_module" "$high_level_documentation" - - local mermaid_diagram=$(create_mermaid_diagram "$name_of_module" "$content_of_module") - if [ $? -ne 0 ]; then - echo "Mermaid diagram creation failed for module: $name_of_module" - return 1 - fi - local mdd_file="$documentation_directory/$name_of_module.mdd" - if [ ! -s "$mdd_file" ]; then - echo -e "$mermaid_diagram" > "$mdd_file" - fi - update_token_usage "$content_of_module" "$mermaid_diagram" + update_token_usage "$content_of_module" "$high_level_documentation" local markdown_documentation_file="$documentation_directory/${name_of_module}_Doc.md" echo -e "## Module: $name_of_module\n$high_level_documentation" >> "$markdown_documentation_file" - if [[ -n "$mermaid_diagram" && "$mermaid_diagram" =~ [^[:space:]] ]]; then - echo -e "## Flow Diagram [via mermaid]\n\`\`\`mermaid\n$mermaid_diagram\n\`\`\`" >> "$markdown_documentation_file" - fi - echo -e "Documentation saved to $markdown_documentation_file\n\n" + # Generate the flow chart for the module + generate_flow_chart "$path_to_module" "$documentation_directory/flowmaps" + + # Add link to the flow chart in the documentation + local flow_chart_name=$(basename "$path_to_module" | cut -f 1 -d '.') + echo -e "\n![Flow Chart of $flow_chart_name](./flowmaps/${flow_chart_name}_FlowChart.png)\n" >> "$markdown_documentation_file" + + echo -e "Documentation saved to $markdown_documentation_file\n\n" >&2 } -function extract_module_names_and_associated_objectives_then_call_bito() { - local filename=$1 - local prompt_file_path=$2 - local lines=() - local current_module="" - local current_objectives="" - local capture_objectives=false - local combined_output="" - local attempt=1 - local MAX_RETRIES=5 - local RETRY_DELAY=10 # seconds - local bito_output - - echo -e "Extracting module names and objectives from file: $filename\n" >&2 - - # Read the file line by line into the array - while IFS= read -r line; do - lines+=("$line") - done < "$filename" - - # Loop through the lines to process them +function extract_module_details_and_call_bito() { + local filename=$1 prompt_file_path=$2 lines=() current_module="" current_objectives="" current_operational_sequence="" capture_objectives=false capture_operational_sequence=false combined_output="" + + echo "Compiling objectives and details for module in $filename..." >&2 + + while IFS= read -r line; do lines+=("$line"); done < "$filename" + for line in "${lines[@]}"; do if [[ $line =~ ^##\ Module:\ (.*) ]]; then if [[ -n $current_module ]]; then - echo "Processing module: $current_module with objectives" >&2 - combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\n\n" + echo "Processing module: $current_module with objectives and operational sequence" >&2 + combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\nOperational Sequence:\n$current_operational_sequence\n\n" fi current_module=${BASH_REMATCH[1]} - current_objectives="" - capture_objectives=false + current_objectives="" current_operational_sequence="" + capture_objectives=false capture_operational_sequence=false elif [[ $line =~ ^-\ \*\*Primary\ Objectives\*\*: ]]; then capture_objectives=true + capture_operational_sequence=false current_objectives+=$(echo $line | sed 's/.*\*\*Primary Objectives\*\*: //')$'\n' + elif [[ $line =~ ^-\ \*\*Operational\ Sequence\*\*: ]]; then + capture_operational_sequence=true + capture_objectives=false + current_operational_sequence+=$(echo $line | sed 's/.*\*\*Operational Sequence\*\*: //')$'\n' elif $capture_objectives && [[ $line =~ ^-\ .+ ]]; then current_objectives+=$(echo $line | sed 's/^-\ //')$'\n' + elif $capture_operational_sequence && [[ $line =~ ^-\ .+ ]]; then + current_operational_sequence+=$(echo $line | sed 's/^-\ //')$'\n' elif [[ $line == "## "* || $line == "" ]]; then - capture_objectives=false + capture_objectives=false capture_operational_sequence=false fi done if [[ -n $current_module ]]; then - echo "Processing module: $current_module with objectives" >&2 - combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\n\n" + echo "Processing module: $current_module with objectives and operational sequence" >&2 + combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\nOperational Sequence:\n$current_operational_sequence\n\n" fi - # Retry logic for calling bito - while [ $attempt -le $MAX_RETRIES ]; do - echo "Attempt $attempt: Running bito for module: $current_module" >&2 - bito_output=$(echo -e "$combined_output" | bito -p "$prompt_file_path") - local ret_code=$? - - if ! bito_response_ok "$ret_code" "$bito_output"; then - echo "Attempt $attempt: bito command for module: $current_module failed or did not return enough content. Retrying in $RETRY_DELAY seconds..." >&2 - sleep $RETRY_DELAY - ((attempt++)) - else - echo "Attempt $attempt: bito command for module: $current_module succeeded with sufficient content." >&2 - echo "$bito_output" - update_token_usage "$combined_output" "$bito_output" - return 0 - fi - done - - echo "Failed to call bito for module: $current_module after $MAX_RETRIES attempts with adequate content." >&2 - return 1 -} - -function fix_mermaid_syntax() { - local mermaid_content="$1" - local fixed_mermaid_content - - # Combine removal of empty parentheses and quotations in one step - fixed_mermaid_content=$(echo "$mermaid_content" | sed 's/()//g; s/"//g') - - # Insert space between an opening square bracket '[' and a forward slash '/' - fixed_mermaid_content=$(echo "$fixed_mermaid_content" | sed 's/\[\//[ \//g') - - # Adjust nested square brackets '[]' - fixed_mermaid_content=$(echo "$fixed_mermaid_content" | sed 's/\[\([^]]*\)\[\([^]]*\)\]\]/[\1 \2]/g') - - echo "$fixed_mermaid_content" -} - -# Function to fix Mermaid diagram syntax using bito AI -function fix_mermaid_syntax_with_bito() { - local fixed_mermaid_content - fixed_mermaid_content=$(echo "$mermaid_content" | bito -p "$prompt_folder/mermaid_doc_prompt.txt" | awk '/^```mermaid$/,/^```$/{if (!/^```mermaid$/ && !/^```$/) print}') - - local ret_code=$? - if ! bito_response_ok "$ret_code" "$fixed_mermaid_content"; then - echo "Error in bito response for fixing mermaid syntax with bito." + if bito_output=$(call_bito_with_retry "$combined_output" "$prompt_file_path" "Failed for module: $current_module"); then + echo "Bito call successful for module: $current_module" >&2 + echo "$bito_output" + update_token_usage "$combined_output" "$bito_output" + else + echo "Failed to call bito for module: $current_module with adequate content." >&2 return 1 fi } -# Function to validate Mermaid diagram syntax -function validate_mermaid_syntax() { - local mermaid_content="$1" - local temp_mmd_file=$(mktemp) - # Write Mermaid content to a temporary file - echo "$mermaid_content" > "$temp_mmd_file" - # Attempt to parse the Mermaid diagram using mmdc - local output=$(mmdc -i "$temp_mmd_file" -o /dev/null 2>&1) - local status=$? - # Clean up the temporary file - rm "$temp_mmd_file" - if [ $status -ne 0 ]; then - echo "Mermaid syntax validation failed. Please check the diagram syntax." >&2 - echo "$output" >&2 - return 1 - fi - return 0 -} +function create_find_command() { + local lang_file="$1" + local folder_to_document="$2" + echo "Assembling command to locate relevant files in $folder_to_document..." >&2 + local find_command="find \"$folder_to_document\" -type f" -# Wrapper function for Mermaid diagram validation and fixing -function fix_and_validate_mermaid() { - local mermaid_content="$1" - - # First, apply the syntax fix regardless of the initial validation - local fixed_mermaid_content - fixed_mermaid_content=$(fix_mermaid_syntax "$mermaid_content") - - # Then, try to validate the fixed Mermaid content - if validate_mermaid_syntax "$fixed_mermaid_content"; then - echo "Fixed Mermaid syntax is valid." >&2 - echo "$fixed_mermaid_content" - return 0 - else - echo "Fixed Mermaid syntax is invalid. Attempting to fix with bito..." >&2 + while IFS= read -r ext; do + find_command="$find_command -o -name \"*.$ext\"" + done < "$lang_file" - # Attempt to fix the syntax using bito - fixed_mermaid_content=$(fix_mermaid_syntax_with_bito "$fixed_mermaid_content") + find_command="${find_command/-o /\\( } \)" + echo "$find_command" +} - # Apply common fixes again after using bito - fixed_mermaid_content=$(fix_mermaid_syntax "$fixed_mermaid_content") +function generate_flow_chart() { + local module_file="$1" + local flowchart_folder="$2" - # Finally, validate the bito-fixed and re-fixed syntax - if validate_mermaid_syntax "$fixed_mermaid_content"; then - echo "Bito re-fixed Mermaid syntax and is valid." >&2 - echo "$fixed_mermaid_content" - return 0 - else - echo "Failed to fix Mermaid syntax even with bito and re-fixing." >&2 - return 1 - fi + # Check if the flowchart folder exists, if not, create it + if [ ! -d "$flowchart_folder" ]; then + echo "Creating flowchart directory: $flowchart_folder" + mkdir -p "$flowchart_folder" fi -} -# Generates Mermaid diagrams from a markdown file, replacing Mermaid code blocks with the generated diagrams. -function generate_mermaid_diagram() { - local md_file="$1" - # Strip the .md extension if present and then append it back to ensure correctness - local md_file_base="${md_file%.md}" + # Define the name of the flow chart file based on the module name + local module_name=$(basename "$module_file" | cut -f 1 -d '.') + local flowchart_file="$flowchart_folder/${module_name}_FlowChart.png" - if command -v mmdc >/dev/null 2>&1; then - echo "Generating Mermaid diagrams in markdown file..." - # Overwrite the markdown file with the generated diagram references - mmdc -i "${md_file_base}.md" -o "${md_file_base}.md" && echo "Mermaid diagrams updated in ${md_file_base}.md" || echo "Failed to update diagrams." + # Call code2flow to generate the flow chart + code2flow "$module_file" -o "$flowchart_file" + + # Check if the flow chart was successfully generated + if [ -f "$flowchart_file" ]; then + echo "Flow chart created for module: $module_name" else - echo "Mermaid CLI not found; skipping diagram generation." + echo "Failed to create flow chart for module: $module_name" >&2 fi } -# Generates Mermaid diagrams from a markdown file, replacing Mermaid code blocks with the generated diagrams. -# Updated function with retry logic and bito response check -function create_mermaid_diagram() { - local module_name="$1" - local module_contents="$2" - local mermaid_definition="flowchart\n$module_contents" - local mermaid_flow_map - local attempt=1 - local MAX_RETRIES=10 - local RETRY_DELAY=5 # seconds - local error_message="" - local bito_output - - while [ $attempt -le $MAX_RETRIES ]; do - echo "Attempt $attempt: Creating Mermaid diagram for module: $module_name" >&2 - bito_output=$(echo -e "Module: $module_name\n---\n$mermaid_definition" | bito -p "$prompt_folder/mermaid_doc_prompt.txt") - local ret_code=$? - - if ! bito_response_ok "$ret_code" "$bito_output"; then - echo "Attempt $attempt: Bito call failed or returned insufficient content. Retrying in $RETRY_DELAY seconds..." >&2 - sleep $RETRY_DELAY - ((attempt++)) - else - mermaid_flow_map=$(echo "$bito_output" | awk '/^```mermaid$/,/^```$/{if (!/^```mermaid$/ && !/^```$/) print}') - mermaid_flow_map=$(fix_and_validate_mermaid "$mermaid_flow_map") - local fix_and_validate_status=$? - - if [ $fix_and_validate_status -eq 0 ]; then - echo "Mermaid diagram created successfully." >&2 - echo "$mermaid_flow_map" - update_token_usage "$mermaid_definition" "$mermaid_flow_map" - return 0 - else - echo "Attempt $attempt: Failed to fix or validate Mermaid syntax. Retrying..." >&2 - sleep $RETRY_DELAY - ((attempt++)) - fi - fi - done +function generate_flow_chart_for_system() { + local source_folder="$1" + local output_file="$2" - echo "Failed to create Mermaid diagram for module: $module_name after $MAX_RETRIES attempts." - return 1 -} + # Check if the source folder exists + if [ ! -d "$source_folder" ]; then + echo "Source folder $source_folder does not exist" >&2 + return 1 + fi -# Function to generate an overview.mdd file containing a Mermaid diagram of the full system by combining all .mdd files in the provided directory and running bito on the combined content to generate a Mermaid diagram -function generate_mdd_overview() { - local dir="$1" - local mermaid_doc_prompt_file="$prompt_folder/system_overview_mermaid_update_prompt.txt" - local overview_mdd_file="$dir/overview.mdd" - local temp_file - local MAX_RETRIES=5 - local RETRY_DELAY=5 # seconds - - echo "Starting to generate overview.mdd..." - - # Initialize variable to store the most recent valid Mermaid diagram - local latest_valid_mermaid_content="" - - # Iterate over each .mdd file in the directory - for mdd_file in "$dir"/*.mdd; do - if [ -f "$mdd_file" ] && [ "$mdd_file" != "$overview_mdd_file" ]; then - echo "Processing $mdd_file..." - local mermaid_script=$(cat "$mdd_file") - - # Apply fix_and_validate_mermaid to each Mermaid script - mermaid_script=$(fix_and_validate_mermaid "$mermaid_script") - local fix_status=$? - - if [ $fix_status -ne 0 ]; then - echo "Mermaid diagram fixing/validation failed for $mdd_file. Skipping..." - continue - fi + # Check if the output directory exists, if not, create it + local output_dir=$(dirname "$output_file") + if [ ! -d "$output_dir" ]; then + echo "Creating directory for system flowchart: $output_dir" + mkdir -p "$output_dir" + fi - echo "Mermaid script found. Processing with bito..." - local attempt=1 - while [ $attempt -le $MAX_RETRIES ]; do - echo "Attempt $attempt: Processing Mermaid script for $mdd_file" >&2 - # Use bito to process the Mermaid script - temp_file=$(mktemp) - echo -e "$mermaid_script" | bito -p "$mermaid_doc_prompt_file" > "$temp_file" - - # Validate the Mermaid script - if validate_mermaid_syntax "$(cat "$temp_file")"; then - echo -e "Valid Mermaid diagram generated successfully for $mdd_file.\n" >&2 - # Update the latest valid Mermaid content - latest_valid_mermaid_content=$(cat "$temp_file") - rm "$temp_file" - # Delete the processed .mdd file - rm "$mdd_file" - update_token_usage "$mermaid_script" "$latest_valid_mermaid_content" - break - else - echo -e "Invalid Mermaid diagram syntax for attempt $attempt. Retrying...\n" >&2 - rm "$temp_file" - sleep $RETRY_DELAY - ((attempt++)) - fi - done - - if [ $attempt -gt $MAX_RETRIES ]; then - echo "Failed to generate a valid Mermaid diagram for $mdd_file after $MAX_RETRIES attempts." - return 1 - fi - fi - done + # Generate a flowchart for the entire system + echo "Generating system flowchart..." + code2flow "$source_folder" -o "$output_file" - # Check if there is valid Mermaid content - if [ -n "$latest_valid_mermaid_content" ]; then - # Save the latest valid Mermaid content to overview.mdd - echo -e "$latest_valid_mermaid_content" > "$overview_mdd_file" - echo "Mermaid overview generated successfully: $overview_mdd_file" + # Check if the flowchart was successfully generated + if [ -f "$output_file" ]; then + echo "System flowchart created successfully" else - echo "Failed to create overview.mdd or no valid diagrams were found." + echo "Failed to create system flowchart" >&2 return 1 fi } -# Function to read extensions from CSV and create the find command -function create_find_command() { - local lang_file="$1" - local folder_to_document="$2" - local find_command="find \"$folder_to_document\" -type f" - - # Read each line from CSV and append it to the find command - while IFS= read -r ext; do - find_command="$find_command -o -name \"*.$ext\"" - done < "$lang_file" - - # Correct the find command by adding parentheses and removing the first '-o' - find_command="${find_command/-o /\\( } \)" - echo "$find_command" -} - # Capture Start Time start_time=$(date +%s) function main() { + echo "Verifying prerequisites before documentation generation..." >&2 + # Check if required tools and files are present check_tools_and_files - # Check if a folder name is provided as an argument + # Check if a folder name is provided as a command line argument if [ $# -eq 0 ]; then - echo "Please provide a folder name as a command line argument" + echo "Please provide a folder name as a command line argument" >&2 exit 1 fi @@ -532,7 +291,7 @@ function main() { # Check if the folder to document exists if [ ! -d "$folder_to_document" ]; then - echo "Folder $folder_to_document does not exist" + echo "Folder $folder_to_document does not exist" >&2 exit 1 fi @@ -554,11 +313,14 @@ function main() { module_files=$(eval $(create_find_command "$lang_csv" "$folder_to_document")) # Check if module_files is empty and display a warning if no files are found - [ -z "$module_files" ] && echo "Warning: No files found for documentation generation." && return + if [ -z "$module_files" ]; then + echo "Warning: No files found for documentation generation." >&2 + return + fi # Generate high-level documentation for each found module file for module_file in $module_files; do - # generate_individual_module_md "$module_file" "$docs_folder" + # Create documentation for the module, including flow chart create_module_documentation "$module_file" "$docs_folder" done @@ -570,46 +332,25 @@ function main() { fi done - # Extract content and call Bito for a system introduction and summary - local introduction_and_summary=$(extract_module_names_and_associated_objectives_then_call_bito "$aggregated_md_file" "$prompt_folder/system_introduction_prompt.txt") + local introduction_and_summary=$(extract_module_details_and_call_bito "$aggregated_md_file" "$prompt_folder/system_introduction_prompt.txt") - # Prepend the introduction and summary to the aggregated markdown file - # Save the current content of the aggregated file temporarily + # Prepend the introduction and summary to the aggregated Markdown file local temp_file=$(mktemp) mv "$aggregated_md_file" "$temp_file" - - # Create a new aggregated file starting with the Markdown-formatted introduction title echo -e "# Introduction :\n" > "$aggregated_md_file" - - # Append the introduction and summary echo "$introduction_and_summary" >> "$aggregated_md_file" - # Call generate_mdd_overview function here, after all .mdd files are created - generate_mdd_overview "$docs_folder" "$aggregated_md_file" - - # Append the content of overview.mdd to the aggregated file extracting only the Mermaid diagram block - if [ -f "$docs_folder/overview.mdd" ]; then - echo -e "\n# Full System Overview\n" >> "$aggregated_md_file" - - # Extract and append only the Mermaid diagram block - awk '/^```mermaid$/,/^```$/' "$docs_folder/overview.mdd" >> "$aggregated_md_file" - else - echo "Overview file not found or empty." - fi + # Generate and append the system flow chart + generate_flow_chart_for_system "$folder_to_document" "$docs_folder/flowmaps/system_flowchart.png" + echo -e "\n# System Flowchart\n\n![System Flowchart](./flowmaps/system_flowchart.png)\n" >> "$aggregated_md_file" # Append the rest of the original aggregated content cat "$temp_file" >> "$aggregated_md_file" - - # Remove the temporary file rm "$temp_file" - # Generate Mermaid diagrams for visual representations overwriting the markdown file with the diagrams - generate_mermaid_diagram "$aggregated_md_file" - - # Log Session Duration and Total Token Usage to the log file + # Log session duration and token usage log_token_usage_and_session_duration - # Notify the user that the documentation has been generated echo "Documentation generated in $docs_folder" } From 5497c31545eefd8b6c25446d4601907f2171159a Mon Sep 17 00:00:00 2001 From: Troys-Code Date: Mon, 4 Dec 2023 20:44:03 -0800 Subject: [PATCH 2/7] Enhanced flowchart generation with additional code2flow options Modified the code2flow command calls in both the generate_flow_chart and generate_flow_chart_for_system functions to include several additional options: --hide-legend, --no-trimming, --verbose, and --skip-parse-errors. These enhancements aim to improve the detail and clarity of the generated flowcharts while also providing more verbose output for better debugging and skipping parse errors to ensure smoother execution. --- .../AI_Prompts/system_introduction_prompt.txt | 2 +- documentation/create_overview_doc/createdoc.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt b/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt index 1276d29..a5d8c5b 100644 --- a/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt +++ b/documentation/create_overview_doc/AI_Prompts/system_introduction_prompt.txt @@ -1 +1 @@ -Write a high level system overview and its purpose using the provided context for this program, keep it detailed, concise and confident. \ No newline at end of file +Write a high level system overview and its purpose using the provided context for this program, keep it detailed, concise, and more importantly factual. \ No newline at end of file diff --git a/documentation/create_overview_doc/createdoc.sh b/documentation/create_overview_doc/createdoc.sh index cd0a1ad..9dfc1e6 100755 --- a/documentation/create_overview_doc/createdoc.sh +++ b/documentation/create_overview_doc/createdoc.sh @@ -231,7 +231,7 @@ function generate_flow_chart() { local flowchart_file="$flowchart_folder/${module_name}_FlowChart.png" # Call code2flow to generate the flow chart - code2flow "$module_file" -o "$flowchart_file" + code2flow "$module_file" -o "$flowchart_file" --hide-legend --no-trimming --verbose --skip-parse-errors # Check if the flow chart was successfully generated if [ -f "$flowchart_file" ]; then @@ -260,7 +260,7 @@ function generate_flow_chart_for_system() { # Generate a flowchart for the entire system echo "Generating system flowchart..." - code2flow "$source_folder" -o "$output_file" + code2flow "$source_folder" -o "$output_file" --hide-legend --no-trimming --verbose --skip-parse-errors # Check if the flowchart was successfully generated if [ -f "$output_file" ]; then From 7a4897179b55b044fbe6c8aac66afb1cfb6f561d Mon Sep 17 00:00:00 2001 From: Troys-Code Date: Mon, 4 Dec 2023 21:08:55 -0800 Subject: [PATCH 3/7] Added checks for code2flow and Graphviz in check_tools_and_files function Enhanced the check_tools_and_files function to include validations for the presence of code2flow and Graphviz's dot command. This update ensures that all necessary dependencies for flowchart generation are available before script execution, thus preventing runtime errors related to missing tools. Included are user-friendly installation instructions for these tools, enhancing the robustness and user experience of the setup process. --- documentation/create_overview_doc/createdoc.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/documentation/create_overview_doc/createdoc.sh b/documentation/create_overview_doc/createdoc.sh index 9dfc1e6..4e54ba2 100755 --- a/documentation/create_overview_doc/createdoc.sh +++ b/documentation/create_overview_doc/createdoc.sh @@ -33,7 +33,7 @@ function log_token_usage_and_session_duration() { function check_tools_and_files() { echo "Ensuring all necessary tools and files are available..." >&2 - local required_tools=("bito") + local required_tools=("bito" "code2flow" "dot") local required_files=("high_level_doc_prompt.txt" "system_introduction_prompt.txt") for tool in "${required_tools[@]}"; do @@ -47,6 +47,14 @@ function check_tools_and_files() { echo " For Windows, download and install the MSI from Bito's website." echo " Follow the instructions provided by the installer." ;; + "code2flow") + echo " Install Code2Flow from: https://github.com/scottrogowski/code2flow" + echo " Ensure it's accessible in your PATH." + ;; + "dot") + echo " Install Graphviz (dot) from: https://graphviz.org/download/" + echo " Ensure it's accessible in your PATH." + ;; esac exit 1 fi From 3852b54114a9d42c2b0fa97a4b098f3163563277 Mon Sep 17 00:00:00 2001 From: Troys-Code Date: Mon, 4 Dec 2023 21:22:18 -0800 Subject: [PATCH 4/7] Refactor README for Code2Flow Integration and Remove Mermaid References - Updated the 'Visualization' section in README to reflect the transition from Mermaid.js to Code2Flow for flowchart generation. Removed all mentions of Mermaid CLI and associated features, focusing exclusively on Code2Flow capabilities. - Revised the 'Prerequisites' section to replace `mermaidcli` installation instructions with `Code2Flow`. - Adjusted the 'Supported Languages' section to include specific languages supported by Code2Flow along with their dependencies. - Removed Mermaid-related prompt files from the 'Prerequisites' list, aligning with the shift to Code2Flow. - Updated the 'Known Issues and Solutions' section by removing references to Mermaid diagram syntax issues, focusing on ongoing improvements and user experience enhancements. - Ensured consistency throughout the README to reflect the updated flowchart generation methodology and tool requirements. --- documentation/create_overview_doc/README.md | 33 +++++++++------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/documentation/create_overview_doc/README.md b/documentation/create_overview_doc/README.md index ce0aafd..d0ab423 100644 --- a/documentation/create_overview_doc/README.md +++ b/documentation/create_overview_doc/README.md @@ -19,17 +19,17 @@ This powerful tool streamlines the creation of high-level documentation for soft - **Auto-Retry Logic and Enhanced Error Handling**: Ensures reliable documentation generation even in unstable environments through sophisticated error handling and retry mechanisms. -- **Visualization with Mermaid.js Flow Maps and Enhanced Syntax Handling**: AI-generated visual flow maps to represent module interactions. Now with improved handling of Mermaid diagram syntax, minimizing manual interventions. - -- **Mermaid CLI Image Conversion**: Transforms Mermaid.js diagrams into images, offering a clear visual representation of your code architecture. +- **Visualization with Code2Flow**: AI-generated visual flow maps to represent module interactions, configured with flags such as --hide-legend, --no-trimming, --verbose, and --skip-parse-errors for optimal detail and clarity. +- **Mermaid CLI Image Conversion**: The tool uses Code2Flow for creating detailed flow maps, offering a clear visual representation of your code architecture. +- **Customizable Flowchart Generation: Code2Flow** Configured with flags such as --hide-legend, --no-trimming, --verbose, and --skip-parse-errors to optimize the detail and clarity of flowcharts.** - **Skippable Files and Directories**: Customize which files and directories to ignore during documentation via the `skip_list.csv`. - **Comprehensive Documentation**: Generates detailed markdown files for each module and compiles them into an overarching High_Level_Doc, complete with visual flow maps. - **Documentation Metrics Logging**: Track your session duration and token usage metrics, recorded in `bito_usage_log.txt`. -- **Required Tool and File Verification**: Checks for the presence of necessary tools ("bito", "mmdc") and prompt files before starting the documentation process. +- **Required Tool and File Verification**: Checks for the presence of necessary tools ("bito", "code2flow", "dot") and prompt files before starting the documentation process. ## Supported Languages @@ -51,19 +51,26 @@ sh kt ``` +For flow map generation with Code2Flow, the tool currently supports the following languages, each with specific dependencies: + +- JavaScript: Requires Acorn for parsing. Ensure Acorn is installed and accessible in your environment. +- Ruby: Uses Parser for parsing. Ensure the Parser gem is installed and accessible. +- PHP: Employs PHP-Parser for parsing. PHP-Parser should be installed and accessible in your environment. +- Python: No additional dependencies are required for Python projects. + +If your project uses a language not supported by Code2Flow for flow map generation, the documentation generation capabilities will still be available, but without the flow map visualization for those specific languages. + ## Prerequisites Ensure the following tools are installed: - `bito` : https://github.com/gitbito/CLI -- `mermaidcli` : https://github.com/mermaid-js/mermaid-cli +- `Code2Flow:` : https://github.com/scottrogowski/code2flow Also, make sure these prompt files are present in a specified prompt folder (`AI_Prompts` by default): - `high_level_doc_prompt.txt` -- `mermaid_doc_prompt.txt` -- `fix_mermaid_syntax_prompt.txt` - `system_introduction_prompt.txt` - `system_overview_mermaid_update_prompt.txt` @@ -123,18 +130,6 @@ To customize the Skip List to fit your project's needs, follow these steps: 5. **Re-run the Script**: - Execute the script again to apply the new Skip List settings. -## Known Issues and Solutions - -### Syntax Errors in Mermaid Diagrams -- **Issue**: Occasional syntax errors in AI-generated Mermaid diagrams, such as misplaced quotes or empty parentheses. -- **Current Solutions**: - - **Automated Fixes**: Script (`fix_mermaid_syntax`) and AI-driven (`fix_mermaid_syntax_with_bito`) methods are used for common syntax corrections. - - **Manual Editing**: For unresolved errors, manual editing can be done using the [Mermaid Live Editor](https://mermaid.live/). - - **Update Command**: Post-editing, update diagrams in your markdown documentation using: - ``` - mmdc -i High_Level_Doc.md -o High_Level_Doc.md - ``` - ### Ongoing Efforts - We're continuously improving our AI models and scripts based on user feedback. - Future updates will focus on reducing manual intervention and enhancing the user experience. From 359a501071589f47bd2f3ad760e99f995018265f Mon Sep 17 00:00:00 2001 From: Troys-Code Date: Wed, 6 Dec 2023 08:09:06 -0800 Subject: [PATCH 5/7] Removed Ref to Mermaid Finishing touches to the Readme on the transition to Code2Flow for Flowmap creation. --- .../AI_Prompts/system_overview_mermaid_update_prompt.txt | 4 ---- documentation/create_overview_doc/README.md | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 documentation/create_overview_doc/AI_Prompts/system_overview_mermaid_update_prompt.txt diff --git a/documentation/create_overview_doc/AI_Prompts/system_overview_mermaid_update_prompt.txt b/documentation/create_overview_doc/AI_Prompts/system_overview_mermaid_update_prompt.txt deleted file mode 100644 index a9285c1..0000000 --- a/documentation/create_overview_doc/AI_Prompts/system_overview_mermaid_update_prompt.txt +++ /dev/null @@ -1,4 +0,0 @@ -Integrate the provided individual Mermaid Markdown scripts to construct a simple system overview diagram. -Each script represents a component of the overall system. -The final output should be a unified, single Mermaid Markdown diagram that cohesively combines all components into a consolidated representation. -Ensure the result is enclosed within Mermaid Markdown code block delimiters and present it as a complete diagram in plain text. \ No newline at end of file diff --git a/documentation/create_overview_doc/README.md b/documentation/create_overview_doc/README.md index d0ab423..918cabd 100644 --- a/documentation/create_overview_doc/README.md +++ b/documentation/create_overview_doc/README.md @@ -21,7 +21,7 @@ This powerful tool streamlines the creation of high-level documentation for soft - **Visualization with Code2Flow**: AI-generated visual flow maps to represent module interactions, configured with flags such as --hide-legend, --no-trimming, --verbose, and --skip-parse-errors for optimal detail and clarity. -- **Mermaid CLI Image Conversion**: The tool uses Code2Flow for creating detailed flow maps, offering a clear visual representation of your code architecture. +- **Code2Flow CLI Image Conversion**: The tool uses Code2Flow for creating detailed flow maps, offering a clear visual representation of your code architecture. - **Customizable Flowchart Generation: Code2Flow** Configured with flags such as --hide-legend, --no-trimming, --verbose, and --skip-parse-errors to optimize the detail and clarity of flowcharts.** - **Skippable Files and Directories**: Customize which files and directories to ignore during documentation via the `skip_list.csv`. @@ -72,7 +72,6 @@ Also, make sure these prompt files are present in a specified prompt folder (`AI - `high_level_doc_prompt.txt` - `system_introduction_prompt.txt` -- `system_overview_mermaid_update_prompt.txt` ## How to Use @@ -94,7 +93,7 @@ The directory includes: - Module Documentation: Individual markdown files for each module, titled `_Doc.md`, detailing the module's purpose, functions, and interactions. -- Aggregated Documentation: A comprehensive markdown file `High_Level_Doc.md`, which consolidates the documentation from each module. This file also includes SVG format flow maps created by Mermaid.js for a visual overview of module interactions, and a final Full System Flow Map in PNG format generated by code2flow for a broader system perspective. +- Aggregated Documentation: A comprehensive markdown file `High_Level_Doc.md`, which consolidates the documentation from each module. This file also includes SVG format flow maps created by Code2Flow for a visual overview of module interactions, and a final Full System Flow Map in PNG format generated by code2flow for a broader system perspective. ## Skip List From 68217ec250dd1b2a66eddf7801abe926d8b8b0ef Mon Sep 17 00:00:00 2001 From: Troys-Code <41653822+Troys-Code@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:41:51 -0800 Subject: [PATCH 6/7] This is the most popular AI tool today December 2023 --- Colab-TextGen-GPU.ipynb | 144 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Colab-TextGen-GPU.ipynb diff --git a/Colab-TextGen-GPU.ipynb b/Colab-TextGen-GPU.ipynb new file mode 100644 index 0000000..b018cfc --- /dev/null +++ b/Colab-TextGen-GPU.ipynb @@ -0,0 +1,144 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "private_outputs": true, + "provenance": [], + "gpuType": "T4", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "accelerator": "GPU" + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# oobabooga/text-generation-webui\n", + "\n", + "After running both cells, a public gradio URL will appear at the bottom in a few minutes. You can optionally generate an API link.\n", + "\n", + "* Project page: https://github.com/oobabooga/text-generation-webui\n", + "* Gradio server status: https://status.gradio.app/" + ], + "metadata": { + "id": "MFQl6-FjSYtY" + } + }, + { + "cell_type": "code", + "source": [ + "#@title 1. Keep this tab alive to prevent Colab from disconnecting you { display-mode: \"form\" }\n", + "\n", + "#@markdown Press play on the music player that will appear below:\n", + "%%html\n", + "