Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1b75f0132 | |||
| 6605503e68 | |||
| 8137a304b3 | |||
| bcb1c5c156 | |||
| bedf5d0f8d |
@ -178,7 +178,7 @@ LLM 正在逐步改变人们的生活,而对于开发者,如何基于 LLM
|
||||
- [玉琳-项目发起人](https://github.com/Sophia-Huang)(内容创作者-Datawhale成员)
|
||||
- [Joye](https://Joyenjoye.com)(内容创作者-数据科学家)
|
||||
- [高立业](https://github.com/0-yy-0)(内容创作者-DataWhale成员-算法工程师)
|
||||
- AaronZ(内容创作者)
|
||||
- [Zhang Yixin](https://github.com/YixinZ-NUS)(内容创作者-IT爱好者)
|
||||
- [万礼行](https://github.com/leason-wan)(内容创作者-视频翻译者)
|
||||
- [仲泰](https://github.com/ztgg0228)(内容创作者-Datawhale成员)
|
||||
- [魂兮](https://github.com/wisdom-pan)(内容创作者-前端工程师)
|
||||
|
||||
File diff suppressed because one or more lines are too long
33
content/Prompt Engineering for Developer/do_contents.py
Normal file
33
content/Prompt Engineering for Developer/do_contents.py
Normal file
@ -0,0 +1,33 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user