Skip to content

Commit

Permalink
feat(nx-dev): improve link text for ai docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Aug 31, 2023
1 parent 1abe35c commit b622e09
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tools/documentation/create-embeddings/src/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,29 @@ async function generateEmbeddings() {

const [responseData] = embeddingResponse.data;

let fullHeading = `${heading}${
url_partial?.length
? ` - ${
url_partial?.split('/')?.[1]?.[0].toUpperCase() +
url_partial?.split('/')?.[1]?.slice(1)
}`
: ''
}`;

if ((heading === null || !heading) && url_partial?.length) {
fullHeading = url_partial
.split('/')
.map((part) => part[0].toUpperCase() + part.slice(1))
.join(' - ');
}

const { error: insertPageSectionError, data: pageSection } =
await supabaseClient
.from('nods_page_section')
.insert({
page_id: page.id,
slug,
heading,
fullHeading,
content,
url_partial,
token_count: embeddingResponse.usage.total_tokens,
Expand Down

0 comments on commit b622e09

Please sign in to comment.