Merge remote-tracking branch 'origin/cz/mergeAll' into fix/minor_ui_adjustments
This commit is contained in:
commit
4552fdcb53
15 changed files with 57 additions and 26 deletions
3
Makefile
3
Makefile
|
|
@ -44,7 +44,8 @@ coverage:
|
||||||
poetry run pytest --cov \
|
poetry run pytest --cov \
|
||||||
--cov-config=.coveragerc \
|
--cov-config=.coveragerc \
|
||||||
--cov-report xml \
|
--cov-report xml \
|
||||||
--cov-report term-missing:skip-covered
|
--cov-report term-missing:skip-covered \
|
||||||
|
--cov-report lcov:coverage/lcov-pytest.info
|
||||||
|
|
||||||
# allow passing arguments to pytest
|
# allow passing arguments to pytest
|
||||||
tests:
|
tests:
|
||||||
|
|
|
||||||
0
src/backend/base/langflow/base/vectorstores/__init__.py
Normal file
0
src/backend/base/langflow/base/vectorstores/__init__.py
Normal file
24
src/backend/base/langflow/base/vectorstores/utils.py
Normal file
24
src/backend/base/langflow/base/vectorstores/utils.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
||||||
|
def chroma_collection_to_records(collection_dict: dict):
|
||||||
|
"""
|
||||||
|
Converts a collection of chroma vectors into a list of records.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
collection_dict (dict): A dictionary containing the collection of chroma vectors.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list: A list of records, where each record represents a document in the collection.
|
||||||
|
"""
|
||||||
|
records = []
|
||||||
|
for i, doc in enumerate(collection_dict["documents"]):
|
||||||
|
record_dict = {
|
||||||
|
"id": collection_dict["ids"][i],
|
||||||
|
"document": doc,
|
||||||
|
}
|
||||||
|
if "metadatas" in collection_dict:
|
||||||
|
for key, value in collection_dict["metadatas"][i].items():
|
||||||
|
record_dict[key] = value
|
||||||
|
records.append(Record(**record_dict))
|
||||||
|
return records
|
||||||
|
|
@ -6,7 +6,7 @@ from langchain_chroma import Chroma
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
from langflow.base.vectorstores.utils import chroma_collection_to_records
|
||||||
from langflow.custom import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
from langflow.schema import Record
|
from langflow.schema import Record
|
||||||
|
|
||||||
|
|
@ -123,6 +123,5 @@ class ChromaComponent(CustomComponent):
|
||||||
)
|
)
|
||||||
|
|
||||||
store = chroma.get()
|
store = chroma.get()
|
||||||
self.status = store
|
self.status = chroma_collection_to_records(store)
|
||||||
|
|
||||||
return chroma
|
return chroma
|
||||||
|
|
|
||||||
|
|
@ -757,6 +757,7 @@ class Graph:
|
||||||
await vertex.build(
|
await vertex.build(
|
||||||
user_id=user_id, inputs=inputs_dict, fallback_to_env_vars=fallback_to_env_vars, files=files
|
user_id=user_id, inputs=inputs_dict, fallback_to_env_vars=fallback_to_env_vars, files=files
|
||||||
)
|
)
|
||||||
|
await chat_service.set_cache(key=vertex.id, data=vertex)
|
||||||
|
|
||||||
if vertex.result is not None:
|
if vertex.result is not None:
|
||||||
params = f"{vertex._built_object_repr()}{params}"
|
params = f"{vertex._built_object_repr()}{params}"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import {
|
||||||
CSVViewErrorTitle,
|
CSVViewErrorTitle,
|
||||||
} from "../../constants/constants";
|
} from "../../constants/constants";
|
||||||
import { useDarkStore } from "../../stores/darkStore";
|
import { useDarkStore } from "../../stores/darkStore";
|
||||||
import { FlowPoolObjectType } from "../../types/chat";
|
import { VertexBuildTypeAPI } from "../../types/api";
|
||||||
import { NodeType } from "../../types/flow";
|
import { NodeType } from "../../types/flow";
|
||||||
import ForwardedIconComponent from "../genericIconComponent";
|
import ForwardedIconComponent from "../genericIconComponent";
|
||||||
import TableComponent from "../tableComponent";
|
import TableComponent from "../tableComponent";
|
||||||
|
|
@ -19,7 +19,7 @@ function CsvOutputComponent({
|
||||||
flowPool,
|
flowPool,
|
||||||
}: {
|
}: {
|
||||||
csvNode: NodeType;
|
csvNode: NodeType;
|
||||||
flowPool: FlowPoolObjectType;
|
flowPool: VertexBuildTypeAPI;
|
||||||
}) {
|
}) {
|
||||||
const csvNodeArtifacts = flowPool?.data?.artifacts?.repr;
|
const csvNodeArtifacts = flowPool?.data?.artifacts?.repr;
|
||||||
const jsonString = csvNodeArtifacts?.replace(/'/g, '"');
|
const jsonString = csvNodeArtifacts?.replace(/'/g, '"');
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ export default function IOFieldView({
|
||||||
(flowPool[node!.id] ?? [])[(flowPool[node!.id]?.length ?? 1) - 1]?.data
|
(flowPool[node!.id] ?? [])[(flowPool[node!.id]?.length ?? 1) - 1]?.data
|
||||||
.results.result ?? "";
|
.results.result ?? "";
|
||||||
|
|
||||||
console.log(flowPoolNode?.data?.artifacts?.records);
|
console.log(
|
||||||
|
(flowPool[node!.id] ?? [])[(flowPool[node!.id]?.length ?? 1) - 1]?.data,
|
||||||
|
);
|
||||||
|
|
||||||
function handleOutputType() {
|
function handleOutputType() {
|
||||||
if (!node) return <>"No node found!"</>;
|
if (!node) return <>"No node found!"</>;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import IconComponent from "../../../../../../../components/genericIconComponent";
|
import IconComponent from "../../../../../../../components/genericIconComponent";
|
||||||
|
import { Button } from "../../../../../../../components/ui/button";
|
||||||
import { Case } from "../../../../../../../shared/components/caseComponent";
|
import { Case } from "../../../../../../../shared/components/caseComponent";
|
||||||
import { FilePreviewType } from "../../../../../../../types/components";
|
import { FilePreviewType } from "../../../../../../../types/components";
|
||||||
import { classNames } from "../../../../../../../utils/utils";
|
import { classNames } from "../../../../../../../utils/utils";
|
||||||
|
|
@ -21,7 +22,7 @@ const ButtonSendWrapper = ({
|
||||||
files,
|
files,
|
||||||
}: ButtonSendWrapperProps) => {
|
}: ButtonSendWrapperProps) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<Button
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"form-modal-send-button",
|
"form-modal-send-button",
|
||||||
noInput
|
noInput
|
||||||
|
|
@ -32,6 +33,8 @@ const ButtonSendWrapper = ({
|
||||||
)}
|
)}
|
||||||
disabled={lockChat || saveLoading}
|
disabled={lockChat || saveLoading}
|
||||||
onClick={(): void => send()}
|
onClick={(): void => send()}
|
||||||
|
variant="none"
|
||||||
|
size="none"
|
||||||
>
|
>
|
||||||
<Case
|
<Case
|
||||||
condition={
|
condition={
|
||||||
|
|
@ -45,7 +48,7 @@ const ButtonSendWrapper = ({
|
||||||
/>
|
/>
|
||||||
</Case>
|
</Case>
|
||||||
|
|
||||||
<Case condition={noInput}>
|
<Case condition={noInput && !lockChat}>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Zap"
|
name="Zap"
|
||||||
className="form-modal-play-icon"
|
className="form-modal-play-icon"
|
||||||
|
|
@ -65,7 +68,7 @@ const ButtonSendWrapper = ({
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
</Case>
|
</Case>
|
||||||
</button>
|
</Button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import useAlertStore from "../../../../../../stores/alertStore";
|
||||||
|
|
||||||
const fsErrorText =
|
const fsErrorText =
|
||||||
"Please ensure your file has one of the following extensions:";
|
"Please ensure your file has one of the following extensions:";
|
||||||
const snErrorTxt = "png, jpg, jpeg, gif, bmp, webp";
|
const snErrorTxt = "png, jpg, jpeg";
|
||||||
|
|
||||||
const useDragAndDrop = (
|
const useDragAndDrop = (
|
||||||
setIsDragging,
|
setIsDragging,
|
||||||
|
|
@ -49,7 +49,7 @@ const useDragAndDrop = (
|
||||||
|
|
||||||
const handleFiles = (files, setFiles, currentFlowId, setErrorData) => {
|
const handleFiles = (files, setFiles, currentFlowId, setErrorData) => {
|
||||||
if (files) {
|
if (files) {
|
||||||
const allowedExtensions = ["png", "jpg", "jpeg", "gif", "bmp", "webp"];
|
const allowedExtensions = ["png", "jpg", "jpeg"];
|
||||||
const file = files?.[0];
|
const file = files?.[0];
|
||||||
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
||||||
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import useAlertStore from "../../../../../../stores/alertStore";
|
||||||
|
|
||||||
const fsErrorText =
|
const fsErrorText =
|
||||||
"Please ensure your file has one of the following extensions:";
|
"Please ensure your file has one of the following extensions:";
|
||||||
const snErrorTxt = "png, jpg, jpeg, gif, bmp, webp";
|
const snErrorTxt = "png, jpg, jpeg";
|
||||||
|
|
||||||
export const useHandleFileChange = (setFiles, currentFlowId) => {
|
export const useHandleFileChange = (setFiles, currentFlowId) => {
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
|
@ -14,7 +14,7 @@ export const useHandleFileChange = (setFiles, currentFlowId) => {
|
||||||
const fileInput = event.target;
|
const fileInput = event.target;
|
||||||
const file = fileInput.files?.[0];
|
const file = fileInput.files?.[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
const allowedExtensions = ["png", "jpg", "jpeg", "gif", "bmp", "webp"];
|
const allowedExtensions = ["png", "jpg", "jpeg"];
|
||||||
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
||||||
|
|
||||||
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import useAlertStore from "../../../../../../stores/alertStore";
|
||||||
|
|
||||||
const fsErrorText =
|
const fsErrorText =
|
||||||
"Please ensure your file has one of the following extensions:";
|
"Please ensure your file has one of the following extensions:";
|
||||||
const snErrorTxt = "png, jpg, jpeg, gif, bmp, webp";
|
const snErrorTxt = "png, jpg, jpeg";
|
||||||
|
|
||||||
const useUpload = (uploadFile, currentFlowId, setFiles, lockChat) => {
|
const useUpload = (uploadFile, currentFlowId, setFiles, lockChat) => {
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
|
@ -21,14 +21,7 @@ const useUpload = (uploadFile, currentFlowId, setFiles, lockChat) => {
|
||||||
const uid = new ShortUniqueId({ length: 3 });
|
const uid = new ShortUniqueId({ length: 3 });
|
||||||
const blob = items[i].getAsFile();
|
const blob = items[i].getAsFile();
|
||||||
if (blob) {
|
if (blob) {
|
||||||
const allowedExtensions = [
|
const allowedExtensions = ["png", "jpg", "jpeg"];
|
||||||
"png",
|
|
||||||
"jpg",
|
|
||||||
"jpeg",
|
|
||||||
"gif",
|
|
||||||
"bmp",
|
|
||||||
"webp",
|
|
||||||
];
|
|
||||||
const fileExtension = blob.name.split(".").pop()?.toLowerCase();
|
const fileExtension = blob.name.split(".").pop()?.toLowerCase();
|
||||||
|
|
||||||
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
if (!fileExtension || !allowedExtensions.includes(fileExtension)) {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ export default function FileCard({
|
||||||
BACKEND_URL.length - 1,
|
BACKEND_URL.length - 1,
|
||||||
)}${BASE_URL_API}files/images/${content}`;
|
)}${BASE_URL_API}files/images/${content}`;
|
||||||
|
|
||||||
|
console.log(imgSrc);
|
||||||
|
|
||||||
if (showFile) {
|
if (showFile) {
|
||||||
if (imgTypes.has(fileType)) {
|
if (imgTypes.has(fileType)) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ export default function IOModal({
|
||||||
</div>
|
</div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
</Button>
|
</Button>
|
||||||
<div>
|
{/* <div>
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
styleClasses="z-50"
|
styleClasses="z-50"
|
||||||
content={
|
content={
|
||||||
|
|
@ -404,7 +404,7 @@ export default function IOModal({
|
||||||
)}
|
)}
|
||||||
></div>
|
></div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ const useFlowsManagerStore = create<FlowsManagerStoreType>((set, get) => ({
|
||||||
readFlowsFromDatabase()
|
readFlowsFromDatabase()
|
||||||
.then((dbData) => {
|
.then((dbData) => {
|
||||||
if (dbData) {
|
if (dbData) {
|
||||||
const { data, flows } = processFlows(dbData, false);
|
const { data, flows } = processFlows(dbData);
|
||||||
const examples = flows.filter(
|
const examples = flows.filter(
|
||||||
(flow) => flow.folder_id === starterFolderId,
|
(flow) => flow.folder_id === starterFolderId,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ test("search components", async ({ page }) => {
|
||||||
await page.getByRole("heading", { name: "Basic Prompting" }).click();
|
await page.getByRole("heading", { name: "Basic Prompting" }).click();
|
||||||
|
|
||||||
await page.getByText("Chat Input").first().click();
|
await page.getByText("Chat Input").first().click();
|
||||||
|
await page.getByTestId("more-options-modal").click();
|
||||||
|
|
||||||
await page.getByTestId("icon-SaveAll").first().click();
|
await page.getByTestId("icon-SaveAll").first().click();
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
await page
|
await page
|
||||||
|
|
@ -98,6 +100,8 @@ test("search components", async ({ page }) => {
|
||||||
})
|
})
|
||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
await page.getByTestId("more-options-modal").click();
|
||||||
|
|
||||||
await page.getByTestId("icon-SaveAll").first().click();
|
await page.getByTestId("icon-SaveAll").first().click();
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
|
|
||||||
|
|
@ -107,6 +111,8 @@ test("search components", async ({ page }) => {
|
||||||
})
|
})
|
||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
await page.getByTestId("more-options-modal").click();
|
||||||
|
|
||||||
await page.getByTestId("icon-SaveAll").first().click();
|
await page.getByTestId("icon-SaveAll").first().click();
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
await page.getByTestId("icon-ChevronLeft").first().click();
|
await page.getByTestId("icon-ChevronLeft").first().click();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue