mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
Merge branch 'main' of https://github.com/arc53/DocsGPT into Demo
This commit is contained in:
@@ -313,7 +313,9 @@ const ConversationBubble = forwardRef<
|
||||
</p>
|
||||
|
||||
<div className="m-2 rounded-xl border-2 border-gray-200 bg-white p-2">
|
||||
<p className="text-black">{sources[openSource].text}</p>
|
||||
<p className="text-break text-black">
|
||||
{sources[openSource].text}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -66,10 +66,19 @@ export function getLocalRecentDocs(): string | null {
|
||||
return doc;
|
||||
}
|
||||
|
||||
export function getLocalPrompt(): string | null {
|
||||
const prompt = localStorage.getItem('DocsGPTPrompt');
|
||||
return prompt;
|
||||
}
|
||||
|
||||
export function setLocalApiKey(key: string): void {
|
||||
localStorage.setItem('DocsGPTApiKey', key);
|
||||
}
|
||||
|
||||
export function setLocalPrompt(prompt: string): void {
|
||||
localStorage.setItem('DocsGPTPrompt', prompt);
|
||||
}
|
||||
|
||||
export function setLocalRecentDocs(doc: Doc): void {
|
||||
localStorage.setItem('DocsGPTRecentDocs', JSON.stringify(doc));
|
||||
let namePath = doc.name;
|
||||
|
||||
@@ -81,6 +81,16 @@ prefListenerMiddleware.startListening({
|
||||
},
|
||||
});
|
||||
|
||||
prefListenerMiddleware.startListening({
|
||||
matcher: isAnyOf(setPrompt),
|
||||
effect: (action, listenerApi) => {
|
||||
localStorage.setItem(
|
||||
'DocsGPTPrompt',
|
||||
JSON.stringify((listenerApi.getState() as RootState).preference.prompt),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
export const selectApiKey = (state: RootState) => state.preference.apiKey;
|
||||
export const selectApiKeyStatus = (state: RootState) =>
|
||||
!!state.preference.apiKey;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from './preferences/preferenceSlice';
|
||||
|
||||
const key = localStorage.getItem('DocsGPTApiKey');
|
||||
const prompt = localStorage.getItem('DocsGPTPrompt');
|
||||
const doc = localStorage.getItem('DocsGPTRecentDocs');
|
||||
|
||||
const store = configureStore({
|
||||
@@ -13,7 +14,10 @@ const store = configureStore({
|
||||
preference: {
|
||||
apiKey: key ?? '',
|
||||
selectedDocs: doc !== null ? JSON.parse(doc) : null,
|
||||
prompt: { name: 'default', id: 'default', type: 'private' },
|
||||
prompt:
|
||||
prompt !== null
|
||||
? JSON.parse(prompt)
|
||||
: { name: 'default', id: 'default', type: 'private' },
|
||||
conversations: null,
|
||||
sourceDocs: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user