File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const openai = new OpenAIApi(configuration);
22
22
dotenv . config ( ) ;
23
23
24
24
const CLUSTER_THRESHOLD = 0.8 ;
25
- const BOOK_ID = "33431849 " ;
25
+ const BOOK_ID = "38318378 " ;
26
26
27
27
const supabaseUrl = process . env . SUPABASE_URL ;
28
28
const supabaseKey = process . env . SUPABASE_KEY ;
@@ -166,16 +166,20 @@ const main = async () => {
166
166
// each quote is a bullet point under the heading
167
167
168
168
let markdown = "" ;
169
+ let tableOfContents = "" ;
169
170
for ( let index = 0 ; index < clusteredQuotes . length ; index ++ ) {
170
171
const cluster = clusteredQuotes [ index ] ;
171
172
const topic = await assignTopicToCluster ( cluster ) ;
172
173
console . log ( "Cluster " + index + ": " + topic ) ;
174
+ tableOfContents += `${ index + 1 } . [Cluster ${ index } - ${ topic } ](#cluster-${ index } ---${ topic } )\n` ;
173
175
markdown += `## Cluster ${ index } - ${ topic } \n` ;
174
176
cluster . forEach ( ( quote ) => {
175
177
markdown += `- ${ quote . text } \n` ;
176
178
} ) ;
177
179
}
178
180
181
+ markdown = `# Table of Contents\n${ tableOfContents } \n${ markdown } ` ;
182
+
179
183
180
184
fs . writeFileSync ( "quotes.md" , markdown ) ;
181
185
} ;
You can’t perform that action at this time.
0 commit comments