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
|
||||
def create(cls):
|
||||
logger.debug("Creating Langfuse instance")
|
||||
from langfuse import Langfuse # type: ignore
|
||||
try:
|
||||
logger.debug("Creating Langfuse instance")
|
||||
from langfuse import Langfuse # type: ignore
|
||||
|
||||
settings_manager = get_settings_service()
|
||||
settings_manager = get_settings_service()
|
||||
|
||||
if (
|
||||
settings_manager.settings.LANGFUSE_PUBLIC_KEY
|
||||
and settings_manager.settings.LANGFUSE_SECRET_KEY
|
||||
):
|
||||
logger.debug("Langfuse credentials found")
|
||||
cls._instance = Langfuse(
|
||||
public_key=settings_manager.settings.LANGFUSE_PUBLIC_KEY,
|
||||
secret_key=settings_manager.settings.LANGFUSE_SECRET_KEY,
|
||||
host=settings_manager.settings.LANGFUSE_HOST,
|
||||
)
|
||||
else:
|
||||
logger.debug("No Langfuse credentials found")
|
||||
if (
|
||||
settings_manager.settings.LANGFUSE_PUBLIC_KEY
|
||||
and settings_manager.settings.LANGFUSE_SECRET_KEY
|
||||
):
|
||||
logger.debug("Langfuse credentials found")
|
||||
cls._instance = Langfuse(
|
||||
public_key=settings_manager.settings.LANGFUSE_PUBLIC_KEY,
|
||||
secret_key=settings_manager.settings.LANGFUSE_SECRET_KEY,
|
||||
host=settings_manager.settings.LANGFUSE_HOST,
|
||||
)
|
||||
else:
|
||||
logger.debug("No Langfuse credentials found")
|
||||
cls._instance = None
|
||||
except ImportError:
|
||||
logger.debug("Langfuse not installed")
|
||||
cls._instance = None
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -388,7 +388,6 @@ export default function ParameterComponent({
|
|||
suffixes={data.node?.template[name].suffixes}
|
||||
onFileChange={(filePath: string) => {
|
||||
data.node!.template[name].file_path = filePath;
|
||||
save();
|
||||
}}
|
||||
></InputFileComponent>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import { typesContext } from "./typesContext";
|
|||
const uid = new ShortUniqueId({ length: 5 });
|
||||
|
||||
const TabsContextInitialValue: TabsContextType = {
|
||||
save: () => {},
|
||||
tabId: "",
|
||||
setTabId: (index: string) => {},
|
||||
isLoading: true,
|
||||
|
|
@ -101,29 +100,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
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() {
|
||||
setIsLoading(true);
|
||||
getTabsDataFromDB().then((DbData) => {
|
||||
|
|
@ -640,7 +616,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
tabId,
|
||||
setTabId,
|
||||
flows,
|
||||
save,
|
||||
incrementNodeId,
|
||||
removeFlow,
|
||||
addFlow,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { FlowType } from "../flow";
|
|||
|
||||
export type TabsContextType = {
|
||||
saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>;
|
||||
save: () => void;
|
||||
tabId: string;
|
||||
isLoading: boolean;
|
||||
setTabId: (index: string) => void;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue