2 Commits
pdf ... main

Author SHA1 Message Date
52fb9a3431 更新 README.md 2023-08-01 15:11:52 +00:00
9e863154b8 Update README.md 2023-07-19 11:02:48 +08:00
3 changed files with 1239 additions and 35 deletions

View File

@ -1,4 +1,4 @@
![figures/readme.png](https://github.com/datawhalechina/prompt-engineering-for-developers/blob/main/figures/readme.jpeg) ![figures/readme.png](figures/readme.jpeg)
# 面向开发者的 LLM 入门课程 # 面向开发者的 LLM 入门课程

File diff suppressed because one or more lines are too long

View File

@ -1,33 +0,0 @@
import os
import codecs
import json
def add_toc(ipynb_file):
f = codecs.open(ipynb_file, 'r')
source = f.read()
y = json.loads(source)
toc = ["\n"]
for item in y["cells"]:
if item["cell_type"]=='markdown':
if len(item["source"]) == 0:
continue
# print(item["source"])
item_start = item['source'][0].strip("\n")
if item_start.startswith("#"):
l = len(item_start.split()[0])
if l<=3 and l>1:
name = " ".join(item_start.split(" ")[1:])
tag = "-".join(item_start.split(" ")[1:])
tab = " "*(l-2)
toc.append(f' {tab}- [{name}](#{tag})\n')
y["cells"][0]['source']= y["cells"][0]['source'][0:1]
y["cells"][0]['source'].extend(toc)
f = codecs.open(ipynb_file, 'w')
f.write(json.dumps(y))
f.close()
for file in os.listdir("."):
if file.endswith("ipynb") and file[0].isdigit():
add_toc(file)