Merge branch 'login' of https://github.com/logspace-ai/langflow into login
This commit is contained in:
commit
6867811626
7 changed files with 25 additions and 17 deletions
|
|
@ -466,9 +466,9 @@ export async function updateUser(user_id: string, user: Users) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getApiKey(user_id: String) {
|
||||
export async function getApiKey() {
|
||||
try {
|
||||
const res = await api.get(`${BASE_URL_API}api_key/${user_id}`);
|
||||
const res = await api.get(`${BASE_URL_API}api_key`);
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
|
|
@ -478,9 +478,9 @@ export async function getApiKey(user_id: String) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function createApiKey(user_id: string) {
|
||||
export async function createApiKey(name:string) {
|
||||
try {
|
||||
const res = await api.post(`${BASE_URL_API}api_key/${user_id}`);
|
||||
const res = await api.post(`${BASE_URL_API}api_key`,{name});
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
|
|
@ -491,9 +491,9 @@ export async function createApiKey(user_id: string) {
|
|||
}
|
||||
|
||||
|
||||
export async function deleteApiKey(user_id: string) {
|
||||
export async function deleteApiKey(api_key: string) {
|
||||
try {
|
||||
const res = await api.delete(`${BASE_URL_API}api_key/${user_id}`);
|
||||
const res = await api.delete(`${BASE_URL_API}api_key/${api_key}`);
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export default function SecretKeyModal({
|
|||
};
|
||||
|
||||
function handleAddNewKey() {
|
||||
createApiKey(data)
|
||||
createApiKey(apiKeyName)
|
||||
.then((res) => {
|
||||
setApiKeyValue(res["api_key"]);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
|
|||
import { TabsContext } from "../../contexts/tabsContext";
|
||||
import { TabsState } from "../../types/tabs";
|
||||
import { validateNodes } from "../../utils/reactflowUtils";
|
||||
import { AuthContext } from "../../contexts/authContext";
|
||||
|
||||
export default function FormModal({
|
||||
flow,
|
||||
|
|
@ -60,6 +61,7 @@ export default function FormModal({
|
|||
|
||||
const [chatHistory, setChatHistory] = useState<ChatMessageType[]>([]);
|
||||
const { reactFlowInstance } = useContext(typesContext);
|
||||
const {accessToken} = useContext(AuthContext);
|
||||
const { setErrorData } = useContext(alertContext);
|
||||
const ws = useRef<WebSocket | null>(null);
|
||||
const [lockChat, setLockChat] = useState(false);
|
||||
|
|
@ -160,7 +162,7 @@ export default function FormModal({
|
|||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO improve check of user authentication
|
||||
function getWebSocketUrl(
|
||||
chatId: string,
|
||||
isDevelopment: boolean = false
|
||||
|
|
@ -173,7 +175,7 @@ export default function FormModal({
|
|||
|
||||
return `${
|
||||
isDevelopment ? "ws" : webSocketProtocol
|
||||
}://${host}${chatEndpoint}`;
|
||||
}://${host}${chatEndpoint}?token=${accessToken}`;
|
||||
}
|
||||
|
||||
function handleWsMessage(data: any) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export default function ApiKeysPage() {
|
|||
function getKeys() {
|
||||
setLoadingKeys(true);
|
||||
if (userData) {
|
||||
getApiKey(userData.id)
|
||||
getApiKey()
|
||||
.then((keys: [ApiKey]) => {
|
||||
keysList.current = keys["api_keys"];
|
||||
setUserId(keys["user_id"]);
|
||||
|
|
@ -196,6 +196,7 @@ export default function ApiKeysPage() {
|
|||
data={api_keys.id}
|
||||
index={index}
|
||||
onConfirm={(index, keys) => {
|
||||
console.log(keys);
|
||||
handleDeleteKey(keys);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue