Spaces:
Sleeping
Sleeping
Download web/src/lib/release.ts from huanx/chatgpt2api: direct link, hf CLI and curl.
- Browser
- Download file 793 Bytes
-
https://huggingface.co/spaces/huanx/chatgpt2api/resolve/main/web/src/lib/release.ts
- Command line
-
hf download hf://spaces/huanx/chatgpt2api/web/src/lib/release.ts
-
curl -L -o release.ts https://huggingface.co/spaces/huanx/chatgpt2api/resolve/main/web/src/lib/release.ts
793 Bytes
| export type ReleaseInfo = { | |
| version: string; | |
| date: string; | |
| items: { type: string; content: string }[]; | |
| }; | |
| export function parseChangelog(content: string): ReleaseInfo[] { | |
| return content | |
| .split(/^## /m) | |
| .slice(1) | |
| .map((block) => { | |
| const [title = "", ...lines] = block.trim().split("\n"); | |
| const [, version = title.trim(), date = ""] = | |
| title.match(/^(.+?)(?:\s+-\s+(.+))?$/) || []; | |
| return { | |
| version: version.trim(), | |
| date: date.trim(), | |
| items: lines | |
| .map((line) => line.trim().match(/^\+\s+\[(.+?)\]\s+(.+)$/)) | |
| .filter((match): match is RegExpMatchArray => Boolean(match)) | |
| .map((match) => ({ type: match[1], content: match[2] })), | |
| }; | |
| }) | |
| .filter((release) => release.items.length); | |
| } | |