Fix file_path not being set in the frontend code (#977)
This commit is contained in:
commit
3ff6d584e4
4 changed files with 19 additions and 42 deletions
|
|
@ -17,23 +17,27 @@ class LangfuseInstance:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls):
|
def create(cls):
|
||||||
logger.debug("Creating Langfuse instance")
|
try:
|
||||||
from langfuse import Langfuse # type: ignore
|
logger.debug("Creating Langfuse instance")
|
||||||
|
from langfuse import Langfuse # type: ignore
|
||||||
|
|
||||||
settings_manager = get_settings_service()
|
settings_manager = get_settings_service()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
settings_manager.settings.LANGFUSE_PUBLIC_KEY
|
settings_manager.settings.LANGFUSE_PUBLIC_KEY
|
||||||
and settings_manager.settings.LANGFUSE_SECRET_KEY
|
and settings_manager.settings.LANGFUSE_SECRET_KEY
|
||||||
):
|
):
|
||||||
logger.debug("Langfuse credentials found")
|
logger.debug("Langfuse credentials found")
|
||||||
cls._instance = Langfuse(
|
cls._instance = Langfuse(
|
||||||
public_key=settings_manager.settings.LANGFUSE_PUBLIC_KEY,
|
public_key=settings_manager.settings.LANGFUSE_PUBLIC_KEY,
|
||||||
secret_key=settings_manager.settings.LANGFUSE_SECRET_KEY,
|
secret_key=settings_manager.settings.LANGFUSE_SECRET_KEY,
|
||||||
host=settings_manager.settings.LANGFUSE_HOST,
|
host=settings_manager.settings.LANGFUSE_HOST,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug("No Langfuse credentials found")
|
logger.debug("No Langfuse credentials found")
|
||||||
|
cls._instance = None
|
||||||
|
except ImportError:
|
||||||
|
logger.debug("Langfuse not installed")
|
||||||
cls._instance = None
|
cls._instance = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,6 @@ export default function ParameterComponent({
|
||||||
suffixes={data.node?.template[name].suffixes}
|
suffixes={data.node?.template[name].suffixes}
|
||||||
onFileChange={(filePath: string) => {
|
onFileChange={(filePath: string) => {
|
||||||
data.node!.template[name].file_path = filePath;
|
data.node!.template[name].file_path = filePath;
|
||||||
save();
|
|
||||||
}}
|
}}
|
||||||
></InputFileComponent>
|
></InputFileComponent>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import { typesContext } from "./typesContext";
|
||||||
const uid = new ShortUniqueId({ length: 5 });
|
const uid = new ShortUniqueId({ length: 5 });
|
||||||
|
|
||||||
const TabsContextInitialValue: TabsContextType = {
|
const TabsContextInitialValue: TabsContextType = {
|
||||||
save: () => {},
|
|
||||||
tabId: "",
|
tabId: "",
|
||||||
setTabId: (index: string) => {},
|
setTabId: (index: string) => {},
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
|
|
@ -101,29 +100,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
return newNodeId.current;
|
return newNodeId.current;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
|
||||||
// added clone deep to avoid mutating the original object
|
|
||||||
let Saveflows = _.cloneDeep(flows);
|
|
||||||
if (Saveflows.length !== 0) {
|
|
||||||
Saveflows.forEach((flow) => {
|
|
||||||
if (flow.data && flow.data?.nodes)
|
|
||||||
flow.data?.nodes.forEach((node) => {
|
|
||||||
//looking for file fields to prevent saving the content and breaking the flow for exceeding the the data limite for local storage
|
|
||||||
Object.keys(node.data.node.template).forEach((key) => {
|
|
||||||
if (node.data.node.template[key].type === "file") {
|
|
||||||
node.data.node.template[key].content = null;
|
|
||||||
node.data.node.template[key].value = "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
window.localStorage.setItem(
|
|
||||||
"tabsData",
|
|
||||||
JSON.stringify({ tabId, flows: Saveflows, id })
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshFlows() {
|
function refreshFlows() {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
getTabsDataFromDB().then((DbData) => {
|
getTabsDataFromDB().then((DbData) => {
|
||||||
|
|
@ -640,7 +616,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
tabId,
|
tabId,
|
||||||
setTabId,
|
setTabId,
|
||||||
flows,
|
flows,
|
||||||
save,
|
|
||||||
incrementNodeId,
|
incrementNodeId,
|
||||||
removeFlow,
|
removeFlow,
|
||||||
addFlow,
|
addFlow,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { FlowType } from "../flow";
|
||||||
|
|
||||||
export type TabsContextType = {
|
export type TabsContextType = {
|
||||||
saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>;
|
saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>;
|
||||||
save: () => void;
|
|
||||||
tabId: string;
|
tabId: string;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
setTabId: (index: string) => void;
|
setTabId: (index: string) => void;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue