Skip to content

Commit

Permalink
Feat: Add universal remoteKnowledgeSource, add notion and website tool
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Oct 2, 2024
1 parent 1a0e190 commit e41b306
Show file tree
Hide file tree
Showing 21 changed files with 1,283 additions and 749 deletions.
15 changes: 8 additions & 7 deletions apiclient/types/knowledge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package types

type KnowledgeFile struct {
Metadata
FileName string `json:"fileName"`
AgentID string `json:"agentID,omitempty"`
WorkflowID string `json:"workflowID,omitempty"`
ThreadID string `json:"threadID,omitempty"`
UploadID string `json:"uploadID,omitempty"`
IngestionStatus IngestionStatus `json:"ingestionStatus,omitempty"`
FileDetails FileDetails `json:"fileDetails,omitempty"`
FileName string `json:"fileName"`
AgentID string `json:"agentID,omitempty"`
WorkflowID string `json:"workflowID,omitempty"`
ThreadID string `json:"threadID,omitempty"`
RemoteKnowledgeSourceID string `json:"remoteKnowledgeSourceID,omitempty"`
RemoteKnowledgeSourceType RemoteKnowledgeSourceType `json:"remoteKnowledgeSourceType,omitempty"`
IngestionStatus IngestionStatus `json:"ingestionStatus,omitempty"`
FileDetails FileDetails `json:"fileDetails,omitempty"`
}

type FileDetails struct {
Expand Down
15 changes: 0 additions & 15 deletions apiclient/types/onedrive.go

This file was deleted.

67 changes: 67 additions & 0 deletions apiclient/types/remoteKnowledgeSource.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package types

var (
RemoteKnowledgeSourceTypeOneDrive RemoteKnowledgeSourceType = "onedrive"
RemoteKnowledgeSourceTypeNotion RemoteKnowledgeSourceType = "notion"
RemoteKnowledgeSourceTypeWebsite RemoteKnowledgeSourceType = "website"
)

type RemoteKnowledgeSourceType string

type RemoteKnowledgeSource struct {
Metadata
AgentID string `json:"agentID,omitempty"`
WorkflowID string `json:"workflowID,omitempty"`
ThreadID string `json:"threadID,omitempty"`
RunID string `json:"runID,omitempty"`
Input RemoteKnowledgeSourceInput `json:"input,omitempty"`
State RemoteKnowledgeSourceState `json:"state,omitempty"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
}

type RemoteKnowledgeSourceList List[RemoteKnowledgeSource]

type RemoteKnowledgeSourceInput struct {
SourceType RemoteKnowledgeSourceType `json:"sourceType,omitempty"`
Exclude []string `json:"exclude,omitempty"`
OneDriveConfig *OneDriveConfig `json:"onedriveConfig,omitempty"`
NotionConfig *NotionConfig `json:"notionConfig,omitempty"`
WebsiteCrawlingConfig *WebsiteCrawlingConfig `json:"websiteCrawlingConfig,omitempty"`
}

type OneDriveConfig struct {
SharedLinks []string `json:"sharedLinks,omitempty"`
}

type NotionConfig struct {
Pages []string `json:"pages,omitempty"`
}

type WebsiteCrawlingConfig struct {
URLs []string `json:"urls,omitempty"`
}

type RemoteKnowledgeSourceState struct {
OneDriveState *OneDriveLinksConnectorState `json:"onedriveState,omitempty"`
NotionState *NotionConnectorState `json:"notionState,omitempty"`
WebsiteCrawlingState *WebsiteCrawlingConnectorState `json:"websiteCrawlingState,omitempty"`
}

type OneDriveLinksConnectorState struct {
Folders FolderSet `json:"folders,omitempty"`
}

type NotionConnectorState struct {
Pages map[string]NotionPage `json:"pages,omitempty"`
}

type NotionPage struct {
URL string `json:"url,omitempty"`
Title string `json:"title,omitempty"`
}

type WebsiteCrawlingConnectorState struct {
ScrapeJobIds map[string]string `json:"scrapeJobIds"`
Folders FolderSet `json:"folders"`
}
241 changes: 222 additions & 19 deletions apiclient/types/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e41b306

Please sign in to comment.