mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
feat: update authentication handling and integrate token usage across frontend and backend
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSelector } from 'react-redux';
|
||||
import {
|
||||
selectSourceDocs,
|
||||
selectSelectedDocs,
|
||||
selectChunks,
|
||||
selectPrompt,
|
||||
} from '../preferences/preferenceSlice';
|
||||
|
||||
import conversationService from '../api/services/conversationService';
|
||||
import Spinner from '../assets/spinner.svg';
|
||||
import Dropdown from '../components/Dropdown';
|
||||
import { Doc } from '../models/misc';
|
||||
import Spinner from '../assets/spinner.svg';
|
||||
import {
|
||||
selectChunks,
|
||||
selectPrompt,
|
||||
selectSelectedDocs,
|
||||
selectSourceDocs,
|
||||
selectToken,
|
||||
} from '../preferences/preferenceSlice';
|
||||
import WrapperModal from './WrapperModal';
|
||||
|
||||
const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com';
|
||||
const embeddingsName =
|
||||
import.meta.env.VITE_EMBEDDINGS_NAME ||
|
||||
@@ -17,9 +22,6 @@ const embeddingsName =
|
||||
|
||||
type StatusType = 'loading' | 'idle' | 'fetched' | 'failed';
|
||||
|
||||
import conversationService from '../api/services/conversationService';
|
||||
import WrapperModal from './WrapperModal';
|
||||
|
||||
export const ShareConversationModal = ({
|
||||
close,
|
||||
conversationId,
|
||||
@@ -28,6 +30,7 @@ export const ShareConversationModal = ({
|
||||
conversationId: string;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const token = useSelector(selectToken);
|
||||
|
||||
const domain = window.location.origin;
|
||||
|
||||
@@ -85,7 +88,7 @@ export const ShareConversationModal = ({
|
||||
sourcePath && (payload.source = sourcePath.value);
|
||||
}
|
||||
conversationService
|
||||
.shareConversation(isPromptable, payload)
|
||||
.shareConversation(isPromptable, payload, token)
|
||||
.then((res) => {
|
||||
return res.json();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user