Skip to content

Commit 1e74d19

Browse files
committed
fix collusion
1 parent d1c731a commit 1e74d19

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

app/models/talk/summary_commands.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def create_summary!
1313
parameters: {
1414
model: "gpt-4o-mini", # Required.
1515
response_format: {type: "json_object"},
16-
messages: messages
16+
messages: create_summary_messages
1717
}
1818
)
1919

@@ -23,14 +23,14 @@ def create_summary!
2323

2424
private
2525

26-
def messages
26+
def create_summary_messages
2727
[
2828
{role: "system", content: "You are a helpful assistant skilled in processing and summarizing transcripts."},
29-
{role: "user", content: prompt}
29+
{role: "user", content: create_summary_prompt}
3030
]
3131
end
3232

33-
def prompt
33+
def create_summary_prompt
3434
<<~PROMPT
3535
You are tasked with creating a summary of a video based on its transcript and metadata. Follow these steps carefully:
3636

app/models/talk/transcript_commands.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,25 @@ def enhance_transcript!
2525
parameters: {
2626
model: "gpt-4o-mini", # Required.
2727
response_format: {type: "json_object"},
28-
messages: messages
28+
messages: enhance_transcript_messages
2929
}
3030
)
3131
raw_response = JSON.repair(response.dig("choices", 0, "message", "content"))
3232
enhanced_json_transcript = JSON.parse(raw_response).dig("transcript")
33+
byebug
3334
update!(enhanced_transcript: Transcript.create_from_json(enhanced_json_transcript))
3435
end
3536

3637
private
3738

38-
def messages
39+
def enhance_transcript_messages
3940
[
4041
{role: "system", content: "You are a helpful assistant skilled in processing and summarizing transcripts."},
41-
{role: "user", content: prompt}
42+
{role: "user", content: enhance_transcript_prompt}
4243
]
4344
end
4445

45-
def prompt
46+
def enhance_transcript_prompt
4647
<<~PROMPT
4748
You are tasked with improving and formatting a raw VTT transcript. Your goal is to correct and enhance the text, organize it into paragraphs, and format it into a specific JSON structure. Follow these instructions carefully to complete the task.
4849
@@ -65,7 +66,7 @@ def prompt
6566
5. For each paragraph, use the start time of its first sentence as the paragraph's start time, and the end time of its last sentence as the paragraph's end time.
6667
6768
6. Format the improved transcript into a JSON structure using this schema:
68-
[{start_time: "00:00:00", end_time: "00:00:05", text: "Hello, world!"},...]
69+
{"transcript": [{start_time: "00:00:00", end_time: "00:00:05", text: "Hello, world!"},...]}
6970
7071
Here is the raw VTT transcript to process:
7172

0 commit comments

Comments
 (0)