Release 0.5.1: Fixes display prompt

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-05 18:26:12 -03:00 • committed by GitHub
commit 3dd80396fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 23 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langflow" name = "langflow"
version = "0.5.0" version = "0.5.1"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"] authors = ["Logspace <contact@logspace.ai>"]
maintainers = [ maintainers = [

View file

@ -202,13 +202,11 @@ class ChatService(Service):
while True: while True:
json_payload = await websocket.receive_json() json_payload = await websocket.receive_json()
try: if isinstance(json_payload, str):
payload = orjson.loads(json_payload) payload = orjson.loads(json_payload)
# except TypeError or JSONDecodeError how? elif isinstance(json_payload, dict):
except Exception as exc:
logger.error(f"Error decoding JSON: {exc}")
payload = json_payload payload = json_payload
if "clear_history" in payload: if "clear_history" in payload and payload["clear_history"]:
self.chat_history.history[client_id] = [] self.chat_history.history[client_id] = []
continue continue

View file

@ -31,13 +31,11 @@ function ApiInterceptor() {
logout(); logout();
navigate("/login"); navigate("/login");
} }
const res = await renewAccessToken(refreshToken);
if (res?.data?.access_token && res?.data?.refresh_token) {
login(res?.data?.access_token, res?.data?.refresh_token);
}
try { try {
const res = await renewAccessToken(refreshToken);
if (res?.data?.access_token && res?.data?.refresh_token) {
login(res?.data?.access_token, res?.data?.refresh_token);
}
if (error?.config?.headers) { if (error?.config?.headers) {
delete error.config.headers["Authorization"]; delete error.config.headers["Authorization"];
error.config.headers["Authorization"] = `Bearer ${cookies.get( error.config.headers["Authorization"] = `Bearer ${cookies.get(
@ -50,6 +48,10 @@ function ApiInterceptor() {
if (axios.isAxiosError(error) && error.response?.status === 401) { if (axios.isAxiosError(error) && error.response?.status === 401) {
logout(); logout();
navigate("/login"); navigate("/login");
} else {
console.error(error);
logout();
navigate("/login");
} }
} }
} }

View file

@ -399,7 +399,6 @@ export async function renewAccessToken(token: string) {
return await api.post(`${BASE_URL_API}refresh?token=${token}`); return await api.post(`${BASE_URL_API}refresh?token=${token}`);
} }
} catch (error) { } catch (error) {
console.log("Error:", error);
throw error; throw error;
} }
} }

View file

@ -261,7 +261,11 @@ export default function FormModal({
} }
if (data.type === "end") { if (data.type === "end") {
if (data.message) { if (data.message) {
updateLastMessage({ str: data.message, end: true }); updateLastMessage({
str: data.message,
end: true,
prompt: template.current,
});
} }
if (data.intermediate_steps) { if (data.intermediate_steps) {
updateLastMessage({ updateLastMessage({
@ -276,19 +280,14 @@ export default function FormModal({
files: data.files, files: data.files,
}); });
} }
if (data.type === "prompt" && data.prompt) {
template.current = data.prompt;
}
setLockChat(false); setLockChat(false);
isStream = false; isStream = false;
} }
if (data.type == "prompt" && data.prompt) {
template.current = data.prompt;
}
if (data.type === "stream" && isStream) { if (data.type === "stream" && isStream) {
if (data.prompt) { updateLastMessage({ str: data.message });
updateLastMessage({ prompt: data.prompt });
} else {
updateLastMessage({ str: data.message });
}
} }
} }