feat: Add new Atlassian Confluence Component for document loading and vector database integration (#2718)
* feat: Add Gemma 2 to Groq model list (#2586) Add gemma2 to groq_constants.py * Adds new ConfluenceComponent module with lazy loading support - Implements ConfluenceComponent to load documents from the Confluence platform. - Adds necessary inputs, including URL, username, API key, space_key, and more. - Supports configuration of max_pages for pagination control. - Implements lazy loading in the load_documents method for incremental document processing. - Allows immediate processing of documents as they are loaded. This new module facilitates integration with the Confluence platform and enables efficient handling of large volumes of data. * Adds new ConfluenceComponent module - Implements ConfluenceComponent to load documents from the Confluence platform. - Adds necessary inputs, including URL, username, API key, space key, and more. - Supports configuration of max_pages for pagination control. This new module facilitates integration with the Confluence platform. * Updated load_documents method to use Data.from_document - Changed load_documents method to convert documents using Data..from_document instead of docs_to_data for better integration with Data module. - Updated trace_type to "tool" because the LangSmith API only supports one of the following types: ["tool", "chain", "llm", "retriever", "embedding", "prompt", "parser"]. * [autofix.ci] apply automated fixes --------- Co-authored-by: Gordon Stein <7331488+gsteinLTU@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
b281a7d25e
commit
114cdb9ac6
6 changed files with 128 additions and 0 deletions
|
|
@ -0,0 +1,85 @@
|
|||
from typing import List
|
||||
from langflow.custom import Component
|
||||
from langflow.io import StrInput, SecretStrInput, BoolInput, DropdownInput, Output, IntInput
|
||||
from langflow.schema import Data
|
||||
from langchain_community.document_loaders import ConfluenceLoader
|
||||
from langchain_community.document_loaders.confluence import ContentFormat
|
||||
|
||||
|
||||
class ConfluenceComponent(Component):
|
||||
display_name = "Confluence"
|
||||
description = "Confluence wiki collaboration platform"
|
||||
documentation = "https://python.langchain.com/v0.2/docs/integrations/document_loaders/confluence/"
|
||||
trace_type = "tool"
|
||||
icon = "Confluence"
|
||||
name = "Confluence"
|
||||
|
||||
inputs = [
|
||||
StrInput(
|
||||
name="url",
|
||||
display_name="Site URL",
|
||||
required=True,
|
||||
info="The base URL of the Confluence Space. Example: https://<company>.atlassian.net/wiki.",
|
||||
),
|
||||
StrInput(
|
||||
name="username",
|
||||
display_name="Username",
|
||||
required=True,
|
||||
info="Atlassian User E-mail. Example: email@example.com",
|
||||
),
|
||||
SecretStrInput(
|
||||
name="api_key",
|
||||
display_name="API Key",
|
||||
required=True,
|
||||
info="Atlassian Key. Create at: https://id.atlassian.com/manage-profile/security/api-tokens",
|
||||
),
|
||||
StrInput(name="space_key", display_name="Space Key", required=True),
|
||||
BoolInput(name="cloud", display_name="Use Cloud?", required=True, value=True, advanced=True),
|
||||
DropdownInput(
|
||||
name="content_format",
|
||||
display_name="Content Format",
|
||||
options=[
|
||||
ContentFormat.EDITOR.value,
|
||||
ContentFormat.EXPORT_VIEW.value,
|
||||
ContentFormat.ANONYMOUS_EXPORT_VIEW.value,
|
||||
ContentFormat.STORAGE.value,
|
||||
ContentFormat.VIEW.value,
|
||||
],
|
||||
value=ContentFormat.STORAGE.value,
|
||||
required=True,
|
||||
advanced=True,
|
||||
info="Specify content format, defaults to ContentFormat.STORAGE",
|
||||
),
|
||||
IntInput(
|
||||
name="max_pages",
|
||||
display_name="Max Pages",
|
||||
required=False,
|
||||
value=1000,
|
||||
advanced=True,
|
||||
info="Maximum number of pages to retrieve in total, defaults 1000",
|
||||
),
|
||||
]
|
||||
|
||||
outputs = [
|
||||
Output(name="data", display_name="Data", method="load_documents"),
|
||||
]
|
||||
|
||||
def build_confluence(self) -> ConfluenceLoader:
|
||||
content_format = ContentFormat(self.content_format)
|
||||
loader = ConfluenceLoader(
|
||||
url=self.url,
|
||||
username=self.username,
|
||||
api_key=self.api_key,
|
||||
cloud=self.cloud,
|
||||
space_key=self.space_key,
|
||||
content_format=content_format,
|
||||
max_pages=self.max_pages,
|
||||
)
|
||||
return loader
|
||||
|
||||
def load_documents(self) -> List[Data]:
|
||||
confluence = self.build_confluence()
|
||||
documents = confluence.load()
|
||||
data = [Data.from_document(doc) for doc in documents] # Using the from_document method of Data
|
||||
self.status = data
|
||||
return data
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from .Confluence import ConfluenceComponent
|
||||
|
||||
__all__ = ["ConfluenceComponent"]
|
||||
25
src/frontend/src/icons/Confluence/Confluence.jsx
Normal file
25
src/frontend/src/icons/Confluence/Confluence.jsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
const ConfluenceIcon = (props) => (
|
||||
<svg
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M26.2078 9.73763C26.435 9.38575 26.6922 8.97739 26.9048 8.65157C26.9964 8.50234 27.0232 8.32499 26.9796 8.15722C26.936 7.98946 26.8253 7.84451 26.6713 7.75319L22.1423 5.09887C22.0635 5.05261 21.9759 5.02173 21.8845 5.00805C21.7931 4.99437 21.6998 4.99815 21.6099 5.01918C21.5201 5.04021 21.4355 5.07806 21.3612 5.13052C21.2869 5.18299 21.2242 5.24902 21.177 5.32477C20.9578 5.68183 20.7345 6.03663 20.5073 6.3891C18.7136 9.20937 16.908 8.86531 13.6572 7.3848L9.15197 5.35084C9.06778 5.31274 8.97643 5.29112 8.88331 5.28724C8.79019 5.28336 8.6972 5.2973 8.60983 5.32825C8.52247 5.35919 8.44251 5.40651 8.37469 5.4674C8.30687 5.52828 8.25256 5.60151 8.21497 5.68273L6.05814 10.3276C5.98511 10.487 5.98071 10.6674 6.04589 10.8298C6.11107 10.9923 6.24062 11.124 6.40666 11.1964C7.35461 11.6221 9.23956 12.471 10.9366 13.2478C17.0476 16.068 22.2426 15.8795 26.2078 9.73763Z"
|
||||
fill="#2584FF"
|
||||
stroke="#2584FF"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
<path
|
||||
d="M5.09768 22.3445C5.31006 22.0231 5.56711 21.5948 5.79316 21.2629C9.76184 15.1191 14.9456 14.9323 21.0681 17.7532C22.5734 18.4435 24.0819 19.1272 25.5937 19.8043C25.7596 19.8767 25.889 20.0083 25.9542 20.1708C26.0193 20.3333 26.0149 20.5136 25.9419 20.673L23.7871 25.3173C23.7496 25.3987 23.6953 25.472 23.6275 25.5329C23.5596 25.5939 23.4797 25.6413 23.3923 25.6722C23.3049 25.7032 23.2119 25.7171 23.1187 25.7131C23.0256 25.7092 22.9343 25.6874 22.8501 25.6492L18.3318 23.6189C15.0841 22.136 13.2812 21.7937 11.4882 24.6145C11.2339 25.0124 11.0015 25.3868 10.8201 25.6753C10.7729 25.751 10.7103 25.817 10.6361 25.8695C10.5618 25.922 10.4773 25.9598 10.3876 25.9808C10.2978 26.0018 10.2046 26.0056 10.1132 25.9919C10.0219 25.9783 9.93439 25.9474 9.85573 25.9011L5.33012 23.248C5.17486 23.1565 5.06351 23.0105 5.02004 22.8415C4.97656 22.6726 5.00445 22.4941 5.09768 22.3445Z"
|
||||
fill="#2584FF"
|
||||
stroke="#2584FF"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
|
||||
export default ConfluenceIcon;
|
||||
4
src/frontend/src/icons/Confluence/Confluence.svg
Normal file
4
src/frontend/src/icons/Confluence/Confluence.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M26.2078 9.73763C26.435 9.38575 26.6922 8.97739 26.9048 8.65157C26.9964 8.50234 27.0232 8.32499 26.9796 8.15722C26.936 7.98946 26.8253 7.84451 26.6713 7.75319L22.1423 5.09887C22.0635 5.05261 21.9759 5.02173 21.8845 5.00805C21.7931 4.99437 21.6998 4.99815 21.6099 5.01918C21.5201 5.04021 21.4355 5.07806 21.3612 5.13052C21.2869 5.18299 21.2242 5.24902 21.177 5.32477C20.9578 5.68183 20.7345 6.03663 20.5073 6.3891C18.7136 9.20937 16.908 8.86531 13.6572 7.3848L9.15197 5.35084C9.06778 5.31274 8.97643 5.29112 8.88331 5.28724C8.79019 5.28336 8.6972 5.2973 8.60983 5.32825C8.52247 5.35919 8.44251 5.40651 8.37469 5.4674C8.30687 5.52828 8.25256 5.60151 8.21497 5.68273L6.05814 10.3276C5.98511 10.487 5.98071 10.6674 6.04589 10.8298C6.11107 10.9923 6.24062 11.124 6.40666 11.1964C7.35461 11.6221 9.23956 12.471 10.9366 13.2478C17.0476 16.068 22.2426 15.8795 26.2078 9.73763Z" fill="#2584FF" stroke="#2584FF" stroke-width="2"/>
|
||||
<path d="M5.09768 22.3445C5.31006 22.0231 5.56711 21.5948 5.79316 21.2629C9.76184 15.1191 14.9456 14.9323 21.0681 17.7532C22.5734 18.4435 24.0819 19.1272 25.5937 19.8043C25.7596 19.8767 25.889 20.0083 25.9542 20.1708C26.0193 20.3333 26.0149 20.5136 25.9419 20.673L23.7871 25.3173C23.7496 25.3987 23.6953 25.472 23.6275 25.5329C23.5596 25.5939 23.4797 25.6413 23.3923 25.6722C23.3049 25.7032 23.2119 25.7171 23.1187 25.7131C23.0256 25.7092 22.9343 25.6874 22.8501 25.6492L18.3318 23.6189C15.0841 22.136 13.2812 21.7937 11.4882 24.6145C11.2339 25.0124 11.0015 25.3868 10.8201 25.6753C10.7729 25.751 10.7103 25.817 10.6361 25.8695C10.5618 25.922 10.4773 25.9598 10.3876 25.9808C10.2978 26.0018 10.2046 26.0056 10.1132 25.9919C10.0219 25.9783 9.93439 25.9474 9.85573 25.9011L5.33012 23.248C5.17486 23.1565 5.06351 23.0105 5.02004 22.8415C4.97656 22.6726 5.00445 22.4941 5.09768 22.3445Z" fill="#2584FF" stroke="#2584FF" stroke-width="2"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
9
src/frontend/src/icons/Confluence/index.tsx
Normal file
9
src/frontend/src/icons/Confluence/index.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import React, { forwardRef } from "react";
|
||||
import SvgConfluence from "./Confluence";
|
||||
|
||||
export const ConfluenceIcon = forwardRef<
|
||||
SVGSVGElement,
|
||||
React.PropsWithChildren<{}>
|
||||
>((props, ref) => {
|
||||
return <SvgConfluence ref={ref} {...props} />;
|
||||
});
|
||||
|
|
@ -168,6 +168,7 @@ import { BotMessageSquareIcon } from "../icons/BotMessageSquare";
|
|||
import { CassandraIcon } from "../icons/Cassandra";
|
||||
import { ChromaIcon } from "../icons/ChromaIcon";
|
||||
import { CohereIcon } from "../icons/Cohere";
|
||||
import { ConfluenceIcon } from "../icons/Confluence";
|
||||
import { CouchbaseIcon } from "../icons/Couchbase";
|
||||
import { CrewAiIcon } from "../icons/CrewAI";
|
||||
import { ElasticsearchIcon } from "../icons/ElasticsearchStore";
|
||||
|
|
@ -578,5 +579,6 @@ export const nodeIconsLucide: iconsType = {
|
|||
MistralAI: MistralIcon,
|
||||
Upstash: UpstashSvgIcon,
|
||||
PGVector: CpuIcon,
|
||||
Confluence: ConfluenceIcon,
|
||||
FreezeAll: freezeAllIcon,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue