-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from alkem-io/develop
Release v0.11.0
- Loading branch information
Showing
27 changed files
with
6,256 additions
and
3,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
fragment CalloutFields on Callout { | ||
id | ||
nameID | ||
type | ||
visibility | ||
comments { | ||
messagesCount | ||
messages { | ||
sender { | ||
... on User { | ||
profile { | ||
url | ||
displayName | ||
} | ||
} | ||
... on VirtualContributor { | ||
profile { | ||
url | ||
displayName | ||
} | ||
} | ||
} | ||
message | ||
timestamp | ||
} | ||
} | ||
framing { | ||
id | ||
profile { | ||
...ProfileFields | ||
} | ||
} | ||
contributions { | ||
post { | ||
id | ||
nameID | ||
profile { | ||
...ProfileFields | ||
} | ||
} | ||
link { | ||
id | ||
uri | ||
profile { | ||
...ProfileNoTagsetFields | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
query knowledgeBaseIngest($knowledgeBaseID: UUID!){ | ||
lookup { | ||
knowledgeBase(ID: $knowledgeBaseID) { | ||
id | ||
profile { | ||
...ProfileFields | ||
} | ||
calloutsSet { | ||
callouts { | ||
...CalloutFields | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import generateDocument from '../generate.document'; | ||
import { Document } from 'langchain/document'; | ||
import { IngestBodyOfKnowledge } from '../event.bus/events/ingest.body.of.knowledge'; | ||
import { AlkemioCliClient } from '../graphql.client/AlkemioCliClient'; | ||
import { processCallouts } from '../process.callouts'; | ||
import { Callout } from '../generated/graphql'; | ||
|
||
export const embedKnowledgeBase = async ( | ||
event: IngestBodyOfKnowledge, | ||
alkemioClient: AlkemioCliClient | ||
) => { | ||
const knowledgeBaseId = event.bodyOfKnowledgeId; | ||
// make sure the service user has sufficient priviliges | ||
const knowledgeBase = await alkemioClient.ingestKnowledgeBase( | ||
knowledgeBaseId | ||
); | ||
const documents: Document[] = []; | ||
const { documentId, source, pageContent, type, title } = | ||
generateDocument(knowledgeBase); | ||
|
||
documents.push( | ||
new Document({ | ||
id: documentId, | ||
pageContent, | ||
metadata: { | ||
documentId, | ||
source, | ||
type, | ||
title, | ||
}, | ||
}) | ||
); | ||
|
||
const calloutDocs = await processCallouts( | ||
(knowledgeBase.calloutsSet?.callouts || []) as Partial<Callout>[], | ||
alkemioClient | ||
); | ||
documents.push(...calloutDocs); | ||
|
||
return { bodyOfKnowledge: knowledgeBase, documents }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Document } from 'langchain/document'; | ||
|
||
import { Space } from '../generated/graphql'; | ||
|
||
import { AlkemioCliClient } from '../graphql.client/AlkemioCliClient'; | ||
import { processSpaceTree } from './process.space.tree'; | ||
import { IngestBodyOfKnowledge } from 'src/event.bus/events/ingest.body.of.knowledge'; | ||
import { ReadResult } from './types'; | ||
|
||
export const embedSpace = async ( | ||
event: IngestBodyOfKnowledge, | ||
alkemioClient: AlkemioCliClient | ||
): Promise<ReadResult> => { | ||
const spaceId = event.bodyOfKnowledgeId; | ||
// make sure the service user has sufficient priviliges | ||
const space = await alkemioClient.ingestSpace(spaceId); | ||
const documents: Document[] = await processSpaceTree( | ||
[space as Partial<Space>], | ||
alkemioClient | ||
); | ||
|
||
return { bodyOfKnowledge: space, documents }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export declare type BodyOfKnowledgeReadResult = { | ||
id: string; | ||
profile: { displayName: string; url: string }; | ||
}; | ||
|
||
export declare type ReadResult = { | ||
documents?: Document[]; | ||
bodyOfKnowledge?: BodyOfKnowledgeReadResult; | ||
}; |
Oops, something went wrong.