diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index 8e425e8b..2863c2ec 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -42,4 +42,12 @@ jobs: # make this work in future releases # cache-from: type=registry,ref=${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:buildcache - # cache-to: type=registry,ref=${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner \ No newline at end of file + # cache-to: type=registry,ref=${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner + + - name: Sync docs to Open WebUI + uses: docker://ghcr.io/open-webui/oikb:latest + with: + args: sync ${{ gitea.workspace }} --kb-id ${{ secrets.KB_ID }} + env: + OPEN_WEBUI_URL: ${{ secrets.OPEN_WEBUI_URL }} + OPEN_WEBUI_API_KEY: ${{ secrets.OPEN_WEBUI_API_KEY }} \ No newline at end of file diff --git a/lib/publications.ts b/lib/publications.ts index 2fedefcc..74f68d17 100644 --- a/lib/publications.ts +++ b/lib/publications.ts @@ -23,9 +23,8 @@ export function getPublicationsData(): Publication[] { return bibtexJson.entries.map((entry) => { const authorNames = entry.fields.author ? entry.fields.author.map( - (author) => `${author.firstName} ${author.lastName}` - ) - : []; + (author) => `${author.firstName} ${author.lastName}` + ): []; let bibtexEntryString = `@${entry.type}{${entry.key},\n`; for (const [key, value] of Object.entries(entry.fields)) { @@ -48,11 +47,11 @@ export function getPublicationsData(): Publication[] { return { key: entry.key, - title: Array.isArray(entry.fields.title) ? entry.fields.title.join(" ") : entry.fields.title, + title: Array.isArray(entry.fields.title) ? entry.fields.title.join(" ") : (entry.fields.title || ""), authors: authorNames, - journal: Array.isArray(journalField) ? journalField.join(" ") : journalField, - year: Array.isArray(entry.fields.year) ? entry.fields.year.join(" ") : entry.fields.year, - url: Array.isArray(entry.fields.url) ? entry.fields.url.join(" ") : entry.fields.url, + journal: Array.isArray(journalField) ? journalField.join(" ") : (journalField || ""), + year: Array.isArray(entry.fields.year) ? entry.fields.year.join(" ") : (entry.fields.year || ""), + url: Array.isArray(entry.fields.url) ? entry.fields.url.join(" ") : (entry.fields.url || ""), bibtex: bibtexEntryString, pdfUrl: `/publications/${entry.key}.pdf`, pdfAvailable: pdfExists, diff --git a/types/bibtex-parser.d.ts b/types/bibtex-parser.d.ts new file mode 100644 index 00000000..b4cf1bb1 --- /dev/null +++ b/types/bibtex-parser.d.ts @@ -0,0 +1,50 @@ +declare module '@retorquere/bibtex-parser' { + // Represents a single author/creator object inside the author array + export interface Creator { + firstName?: string; + lastName?: string; + prefix?: string; + suffix?: string; + initial?: string; + useprefix?: boolean; + family?: string; + given?: string; + name?: string; + } + + // Represents the fields object inside an entry. + // 'author' is specifically typed, everything else is treated as an array of strings or a single string. + export interface Fields { + author?: Creator[]; + editor?: Creator[]; + translator?: Creator[]; + title?: string | string[]; + journal?: string | string[]; + booktitle?: string | string[]; + year?: string | string[]; + url?: string | string[]; + [key: string]: any; // Catch-all for other BibTeX fields (volume, pages, publisher, etc.) + } + + // Represents a single parsed BibTeX entry + export interface Entry { + type: string; + key: string; + fields: Fields; + crossref?: any; + creators?: Record; + } + + // Represents the overall output of the parse function + export interface Library { + entries: Entry[]; + errors: any[]; + comments: string[]; + strings: Record; + jabref?: any; + } + + // The main parse function you are importing + export function parse(input: string, options?: any): Library; + export function parseAsync(input: string, options?: any): Promise; +} \ No newline at end of file