bluenevus commited on
Commit
530b93c
·
verified ·
1 Parent(s): dd98907

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -3,6 +3,7 @@ from datetime import datetime, timedelta
3
  import google.generativeai as genai
4
  from github import Github, GithubException
5
  import docx
 
6
 
7
  def generate_release_notes(github_repo, github_token, gemini_api_key, start_date, end_date):
8
  try:
@@ -39,7 +40,8 @@ def generate_release_notes(github_repo, github_token, gemini_api_key, start_date
39
  - Do not use any Markdown syntax (*, #, `, etc.)
40
  - Use plain text only
41
  - For section headers, simply use the text as is (e.g., "New Features:")
42
- - For list items, use simple numbers or bullet points (•) followed by a space
 
43
  - Keep the text structure simple and easy to convert to a Word document format
44
  """
45
 
@@ -50,11 +52,14 @@ def generate_release_notes(github_repo, github_token, gemini_api_key, start_date
50
  doc.add_heading('Release Notes', 0)
51
 
52
  for line in release_notes.split('\n'):
53
- if line.strip().endswith(':'):
54
- doc.add_heading(line.strip(), level=1)
55
- elif line.strip().startswith('•') or (line.strip() and line.strip()[0].isdigit()):
56
- doc.add_paragraph(line.strip(), style='List Bullet')
57
- else:
 
 
 
58
  doc.add_paragraph(line)
59
 
60
  temp_file = "release_notes.docx"
 
3
  import google.generativeai as genai
4
  from github import Github, GithubException
5
  import docx
6
+ import re
7
 
8
  def generate_release_notes(github_repo, github_token, gemini_api_key, start_date, end_date):
9
  try:
 
40
  - Do not use any Markdown syntax (*, #, `, etc.)
41
  - Use plain text only
42
  - For section headers, simply use the text as is (e.g., "New Features:")
43
+ - For list items, use a single bullet point (•) followed by a space
44
+ - Do not use multiple bullet points or numbers for a single item
45
  - Keep the text structure simple and easy to convert to a Word document format
46
  """
47
 
 
52
  doc.add_heading('Release Notes', 0)
53
 
54
  for line in release_notes.split('\n'):
55
+ line = line.strip()
56
+ if line.endswith(':'):
57
+ doc.add_heading(line, level=1)
58
+ elif line.startswith(''):
59
+ # Remove extra bullet points if present
60
+ cleaned_line = re.sub(r'^•+\s*', '• ', line)
61
+ doc.add_paragraph(cleaned_line, style='List Bullet')
62
+ elif line:
63
  doc.add_paragraph(line)
64
 
65
  temp_file = "release_notes.docx"