@@ -61,7 +61,7 @@ def get_existing_blog_posts():
6161
6262# Get existing blog posts
6363existing_posts = get_existing_blog_posts ()
64- existing_posts_text = "\n " .join ([f"标题: { post [' title' ] } \n 描述: { post [ 'description' ] } " for post in existing_posts ])
64+ existing_posts_text = "\n " .join ([post [" title" ] for post in existing_posts ])
6565print (f"Loaded { len (existing_posts )} existing blog posts." )
6666
6767topics = [topic .get_text (strip = True ) for topic in scrape_website ("https://news.ycombinator.com/" , ".titleline" )]
@@ -72,7 +72,7 @@ def extract_topic(topics):
7272 global deepseek , existing_posts_text
7373 return generate ([
7474 {"role" : "system" , "content" : "你在为一篇技术博客确定一个主题。直接用中文输出主题。" },
75- {"role" : "user" , "content" : f"阅读以下是HackerNews的热门文章,然后写一个可以用于技术博客的主题。这个主题应当是一个通用、普通的技术,不能是一个事件或其它东西。\n \n { topics } \n \n 以下是已有的博客文章,请避免选择相似的主题:\n \n { existing_posts_text } \n \n 只需要一个主题,直接输出。" },
75+ {"role" : "user" , "content" : f"阅读以下是HackerNews的热门文章,然后写一个可以用于技术博客的主题。这个主题应当是一个通用、普通的技术,不能是一个事件或其它东西。\n \n { topics } \n \n 以下是已有的博客文章,请避免选择相似的主题:\n { existing_posts_text } \n \n 只需要一个主题,直接输出。" },
7676 ], deepseek , "deepseek-chat" )
7777
7878def outline (topic ):
@@ -85,13 +85,13 @@ def write_from_outline(outline):
8585 global deepseek , existing_posts_text
8686 return generate ([
8787 {"role" : "system" , "content" : "你是一位专业技术博客作者。在写作时请遵循以下中文排版规范:1) 中文与英文、数字之间需要有空格;2) 中文标点与英文、数字之间不加空格;3) 使用全角中文标点;4) 专有名词大小写正确;5) 英文、数字使用半角字符;6) 使用直角引号「」。" },
88- {"role" : "user" , "content" : f"{ outline } \n \n 根据这个提纲中关于技术知识的部分,写出一篇技术博客文章。文章中避免出现图片,避免使用列表。每一段出现的代码都进行较为详细的解读。在讲述内容时尽量使用段落的语言,语言风格可以略偏专业,但保持清晰。\n \n 以下是已有的博客文章,请确保你的内容与它们不重复: \n \n { existing_posts_text } \n \n 使用Markdown (要求符合Common Markdown规范)输出,使用LaTeX公式(注意:数学的开闭定界符前后不能有字母或数字字符。像x$a + b = c$或$a + b = c$1将无法渲染为数学公式(所有$会被渲染为$);但x $\\ infty$ 1和($\\ infty$)会正常渲染),标题尽量只用一级标题 `#` 和二级标题 `##`,不要用分割线。直接输出正文。" }
88+ {"role" : "user" , "content" : f"{ outline } \n \n 根据这个提纲中关于技术知识的部分,写出一篇技术博客文章。文章中避免出现图片,避免使用列表。每一段出现的代码都进行较为详细的解读。在讲述内容时尽量使用段落的语言,语言风格可以略偏专业,但保持清晰。使用Markdown (要求符合Common Markdown规范)输出,使用LaTeX公式(注意:数学的开闭定界符前后不能有字母或数字字符。像x$a + b = c$或$a + b = c$1将无法渲染为数学公式(所有$会被渲染为$);但x $\\ infty$ 1和($\\ infty$)会正常渲染),标题尽量只用一级标题 `#` 和二级标题 `##`,不要用分割线。请遵循中文排版规范,确保中英文之间有空格,使用正确的标点符号 。直接输出正文。" }
8989 ], deepseek , "deepseek-reasoner" )
9090
9191def summary (article ):
9292 global deepseek
9393 return generate ([
94- {"role" : "system" , "content" : "你是一个技术博客简介写作者,简介不一定需要涵盖文章的全部内容,能起到一定的提示作用即可。直接输出简介。请遵循中文排版规范,确保中英文之间有空格,使用正确的标点符号。 " },
94+ {"role" : "system" , "content" : "你是一个技术博客简介写作者,简介不一定需要涵盖文章的全部内容,能起到一定的提示作用即可。直接输出简介。" },
9595 {"role" : "user" , "content" : f"给这篇文章写一个15字的简短介绍:\n \n { article } " }
9696 ], deepseek , "deepseek-chat" )
9797
0 commit comments