Skip to content

Commit

Permalink
🎖 Add shields.io repo metadata badges to base template.
Browse files Browse the repository at this point in the history
  • Loading branch information
eli64s committed Jun 21, 2023
1 parent bd2ccc6 commit 027f7ac
Show file tree
Hide file tree
Showing 9 changed files with 2,449 additions and 2,433 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<img src="https://img.shields.io/badge/Anaconda-44A833.svg?&logo=Anaconda&logoColor=white" alt="Anaconda" />
</p>

![GitHub top language](https://img.shields.io/github/languages/top/eli64s/README-AI)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/eli64s/README-AI)
![GitHub last commit](https://img.shields.io/github/last-commit/eli64s/readme-ai)
![GitHub license](https://img.shields.io/github/license/eli64s/README-AI)
![GitHub top language](https://img.shields.io/github/languages/top/eli64s/README-AI?color=5D6D7E)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/eli64s/README-AI?color=5D6D7E)
![GitHub last commit](https://img.shields.io/github/last-commit/eli64s/readme-ai?color=5D6D7E)
![GitHub license](https://img.shields.io/github/license/eli64s/README-AI?color=5D6D7E)
</div>

---
Expand Down Expand Up @@ -63,7 +63,7 @@ Additionally, regularly monitor your API usage and costs by visiting the [OpenAI

## 👾 Demo

[![demo](./examples/imgs/demo.png)](https://github-production-user-asset-6210df.s3.amazonaws.com/43382407/246677587-818e7346-209b-4def-9b93-11efb1b52520.mp4)
[![demo](./examples/imgs/demo.png)](https://youtu.be/0wbgjL0FMxY)

---

Expand Down Expand Up @@ -401,6 +401,7 @@ bash scripts/test.sh
## 👏 Acknowledgments

*Badges*
- [Shields.io](https://shields.io/)
- [Aveek-Saha/GitHub-Profile-Badges](https://github.com/Aveek-Saha/GitHub-Profile-Badges)
- [Ileriayo/Markdown-Badges](https://github.com/Ileriayo/markdown-badges)

Expand Down
7 changes: 6 additions & 1 deletion conf/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following includes a list of the summaries of the files in the repository:
Craft 3-4 sentences that encapsulate the core functionalities of the project, its purpose, and its value proposition.
"""
slogan = "Conceptualize a catchy and memorable slogan for the GitHub project: {}. Limit your response to 80 characters."

# Markdown Templates
[md]
default = "[ℹ️ INSERT-DESCRIPTION]"
Expand All @@ -71,8 +72,12 @@ header = """\n<div align="center">
<h3>◦ Developed with the software and tools listed below.</h3>
"""
badges = """<p align="center">
{}
{0}
</p>
\n![GitHub top language](https://img.shields.io/github/languages/top/{1}?style&color=5D6D7E)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/{1}?style&color=5D6D7E)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/{1}?style&color=5D6D7E)
![GitHub license](https://img.shields.io/github/license/{1}?style&color=5D6D7E)
</div>
\n---
"""
Expand Down
4,828 changes: 2,414 additions & 2,414 deletions conf/svg/badges_compressed.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions scripts/run_batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ repositories=(
"https://github.com/olliefr/docker-gs-ping"
"https://github.com/DownWithUp/CallMon"
"https://github.com/rumaan/file.io-Android-Client"
"https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript"
"https://github.com/idosal/assistant-chat-gpt"
"https://github.com/rumaan/file.io-Android-Client"
"https://github.com/eli64s/readme-ai"
"https://github.com/eli64s/flink-flow"
)

for repo in "${repositories[@]}"
Expand Down
2 changes: 1 addition & 1 deletion setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if conda_env_exists "readme_ai"; then
else
# Create a new conda environment named 'readme_ai'
echo "Creating a new conda environment named 'readme_ai' with Python 3.8..."
conda env create -f setup/environment.yaml -n readme_ai || {
conda env create -f setup/environment.yaml || {
echo "Error creating the 'readme_ai' environment. Aborting."
exit 1
}
Expand Down
3 changes: 2 additions & 1 deletion src/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def create_readme_parts(
"""Creates each section of the README Markdown file."""
name = conf.git.name
repo = conf.git.repository
user_repo = utils.extract_username_reponame(repo)
cwd_path = Path.cwd()
badges_path = cwd_path / conf.paths.badges
badges_dict = FileHandler().read(badges_path)
Expand All @@ -49,7 +50,7 @@ def create_readme_parts(

md_file_parts = [
conf.md.header,
conf.md.badges.format(md_badges),
conf.md.badges.format(md_badges, user_repo),
conf.md.toc,
conf.md.intro,
conf.md.tree,
Expand Down
11 changes: 0 additions & 11 deletions src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import httpx
import openai
from cachetools import TTLCache
from httpx import HTTPStatusError
from tenacity import (
retry,
retry_if_exception_type,
Expand All @@ -25,16 +24,6 @@ class OpenAIHandler:

LOGGER = Logger(__name__)

class RetryAfter(HTTPStatusError):
"""Custom exception for HTTP errors."""

pass

class OpenAIError(Exception):
"""Custom exception for OpenAI API errors."""

pass

def __init__(self, conf: conf.AppConfig):
"""Initialize the OpenAI API handler.
Expand Down
3 changes: 3 additions & 0 deletions src/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def process_language_mapping(self, df: pd.DataFrame) -> pd.DataFrame:
df["setup"] = df["setup"].apply(
lambda x: x if isinstance(x, list) else [None, None]
)
if "setup" not in df.columns:
df["setup"] = [None] * len(df)

df[["install", "run", "test"]] = pd.DataFrame.from_records(
df["setup"].to_list(), columns=["install", "run", "test"]
)
Expand Down
12 changes: 12 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def clone_repository(url: str, repo_path: Path) -> None:
raise ValueError(f"Error cloning repository: {exc}") from exc


def extract_username_reponame(url):
"""Extract username and repository name from a GitHub URL."""
pattern = r'https?://github.com/([^/]+)/([^/]+)'
match = re.match(pattern, url)

if match:
username, reponame = match.groups()
return f"{username}/{reponame}"
else:
return "Invalid GitHub URL"


def adjust_max_tokens(max_tokens: int, prompt: str, target: str = "Hello!") -> int:
"""Adjust the maximum number of tokens based on the specific prompt."""
is_valid_prompt = prompt.strip().startswith(target.strip())
Expand Down

0 comments on commit 027f7ac

Please sign in to comment.