Yijia-Plaud commited on
Commit
97e6c25
·
verified ·
1 Parent(s): f81bcee

Update llm_utils.py

Browse files
Files changed (1) hide show
  1. llm_utils.py +14 -8
llm_utils.py CHANGED
@@ -102,23 +102,29 @@ def analyze_meeting_transcript(transcript_text):
102
 
103
  return industry, meeting_purpose, suggested_template
104
 
105
- def generate_summary(transcript_text, reference_summary_text=None, auto_template_structure=None):
106
- """Generates the meeting summary."""
 
 
 
107
  if reference_summary_text:
108
  prompt = SUMMARIZE_WITH_REFERENCE_TEMPLATE_PROMPT.format(
109
  transcript_text=transcript_text,
110
- reference_summary_text=reference_summary_text
 
111
  )
112
  elif auto_template_structure:
113
  prompt = SUMMARIZE_WITH_AUTO_TEMPLATE_PROMPT.format(
114
  transcript_text=transcript_text,
115
- template_structure=auto_template_structure
 
116
  )
117
  else:
118
  # Fallback or default summarization if no template is provided
119
  # This case should ideally be handled by ensuring one of the templates is always available
120
- prompt = f"Please summarize the following meeting transcript:\n\n{transcript_text}"
121
-
 
122
  return call_openrouter_api(prompt)
123
 
124
  if __name__ == '__main__':
@@ -143,7 +149,7 @@ if __name__ == '__main__':
143
  print(f"Suggested Template:\n{template}")
144
 
145
  print("\n--- Generating Summary (with auto template) ---")
146
- summary1 = generate_summary(transcript, auto_template_structure=template)
147
  print(f"Summary 1:\n{summary1}")
148
 
149
  print("\n--- Generating Summary (with example reference template) ---")
@@ -159,7 +165,7 @@ if __name__ == '__main__':
159
  **Action Items:**
160
  - User A: Task X (Due: YYYY-MM-DD)
161
  """
162
- summary2 = generate_summary(transcript, reference_summary_text=example_ref_summary)
163
  print(f"Summary 2:\n{summary2}")
164
  else:
165
  print(f"Could not parse {example_srt_path} for testing.")
 
102
 
103
  return industry, meeting_purpose, suggested_template
104
 
105
+ def generate_summary(transcript_text, reference_summary_text=None, auto_template_structure=None, user_notes=None):
106
+ """Generates the meeting summary with optional user notes."""
107
+ # Process user notes - if empty, provide appropriate message
108
+ processed_user_notes = "无用户手动记录的笔记" if not user_notes or not user_notes.strip() else user_notes.strip()
109
+
110
  if reference_summary_text:
111
  prompt = SUMMARIZE_WITH_REFERENCE_TEMPLATE_PROMPT.format(
112
  transcript_text=transcript_text,
113
+ reference_summary_text=reference_summary_text,
114
+ user_notes=processed_user_notes
115
  )
116
  elif auto_template_structure:
117
  prompt = SUMMARIZE_WITH_AUTO_TEMPLATE_PROMPT.format(
118
  transcript_text=transcript_text,
119
+ template_structure=auto_template_structure,
120
+ user_notes=processed_user_notes
121
  )
122
  else:
123
  # Fallback or default summarization if no template is provided
124
  # This case should ideally be handled by ensuring one of the templates is always available
125
+ user_notes_text = f"\n\nUser's Manual Notes:\n{user_notes}" if user_notes and user_notes.strip() else ""
126
+ prompt = f"Please summarize the following meeting transcript:{user_notes_text}\n\n{transcript_text}"
127
+ #print(f"Prompt: {prompt}")
128
  return call_openrouter_api(prompt)
129
 
130
  if __name__ == '__main__':
 
149
  print(f"Suggested Template:\n{template}")
150
 
151
  print("\n--- Generating Summary (with auto template) ---")
152
+ summary1 = generate_summary(transcript, auto_template_structure=template, user_notes="测试关键笔记:重要决策点")
153
  print(f"Summary 1:\n{summary1}")
154
 
155
  print("\n--- Generating Summary (with example reference template) ---")
 
165
  **Action Items:**
166
  - User A: Task X (Due: YYYY-MM-DD)
167
  """
168
+ summary2 = generate_summary(transcript, reference_summary_text=example_ref_summary, user_notes="测试关键笔记:关注预算和时间节点")
169
  print(f"Summary 2:\n{summary2}")
170
  else:
171
  print(f"Could not parse {example_srt_path} for testing.")