🐛 Fixes display prompt (#1015)
This commit is contained in:
commit
19586c4ec6
4 changed files with 20 additions and 22 deletions
|
|
@ -202,13 +202,11 @@ class ChatService(Service):
|
|||
|
||||
while True:
|
||||
json_payload = await websocket.receive_json()
|
||||
try:
|
||||
if isinstance(json_payload, str):
|
||||
payload = orjson.loads(json_payload)
|
||||
# except TypeError or JSONDecodeError how?
|
||||
except Exception as exc:
|
||||
logger.error(f"Error decoding JSON: {exc}")
|
||||
elif isinstance(json_payload, dict):
|
||||
payload = json_payload
|
||||
if "clear_history" in payload:
|
||||
if "clear_history" in payload and payload["clear_history"]:
|
||||
self.chat_history.history[client_id] = []
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -31,13 +31,11 @@ function ApiInterceptor() {
|
|||
logout();
|
||||
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 {
|
||||
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) {
|
||||
delete error.config.headers["Authorization"];
|
||||
error.config.headers["Authorization"] = `Bearer ${cookies.get(
|
||||
|
|
@ -50,6 +48,10 @@ function ApiInterceptor() {
|
|||
if (axios.isAxiosError(error) && error.response?.status === 401) {
|
||||
logout();
|
||||
navigate("/login");
|
||||
} else {
|
||||
console.error(error);
|
||||
logout();
|
||||
navigate("/login");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,7 +399,6 @@ export async function renewAccessToken(token: string) {
|
|||
return await api.post(`${BASE_URL_API}refresh?token=${token}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,7 +261,11 @@ export default function FormModal({
|
|||
}
|
||||
if (data.type === "end") {
|
||||
if (data.message) {
|
||||
updateLastMessage({ str: data.message, end: true });
|
||||
updateLastMessage({
|
||||
str: data.message,
|
||||
end: true,
|
||||
prompt: template.current,
|
||||
});
|
||||
}
|
||||
if (data.intermediate_steps) {
|
||||
updateLastMessage({
|
||||
|
|
@ -276,19 +280,14 @@ export default function FormModal({
|
|||
files: data.files,
|
||||
});
|
||||
}
|
||||
if (data.type === "prompt" && data.prompt) {
|
||||
template.current = data.prompt;
|
||||
}
|
||||
|
||||
setLockChat(false);
|
||||
isStream = false;
|
||||
}
|
||||
if (data.type == "prompt" && data.prompt) {
|
||||
template.current = data.prompt;
|
||||
}
|
||||
if (data.type === "stream" && isStream) {
|
||||
if (data.prompt) {
|
||||
updateLastMessage({ prompt: data.prompt });
|
||||
} else {
|
||||
updateLastMessage({ str: data.message });
|
||||
}
|
||||
updateLastMessage({ str: data.message });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue