Skip to content

Commit bbf6b42

Browse files
authored
Enable chat history (#180)
* Temp chat lifecycle rule only applies to tmp/ now For safety's sake, we applied the rule to *all* files initially; but now we're going to enable chat history, so we only want the temp file logic to apply to the temporary file directory. * Disable temporary chats This is a minimal way to re-enable chat history for all. There's other code still left that is geared towards a temp-chat-only solution that I've left in the codebase (such as showing temp chats in the sidebar history), in case we change our mind again. If we eventually let users choose chat history vs. temp chats, we should take care to remove that special logic later. For now, I'm assuming that we either want all chats to have history, or none of them. * Removed temporary chat notice from sidebar Now that all conversations are saved, this is no longer relevant. * Remove references to temporary chat from FAQ Now that we're retaining all conversations, that part needs updating. * Update language in FAQ for chat history * Update comments after removing temp chat * Fixed typo
1 parent e8df3d8 commit bbf6b42

File tree

9 files changed

+22
-87
lines changed

9 files changed

+22
-87
lines changed

client/src/components/Chat/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function Header() {
7676
{interfaceConfig.presets === true && interfaceConfig.modelSelect && <PresetsMenu />}
7777
{hasAccessToBookmarks === true && <BookmarkMenu />}
7878
{hasAccessToMultiConvo === true && <AddMultiConvo />}
79-
{/* NJ: We force all chats to be temporary & disable exporting/sharing */}
79+
{/* NJ: We disable exporting/sharing */}
8080
{isSmallScreen && false && (
8181
<>
8282
<ExportAndShareMenu
@@ -89,7 +89,7 @@ function Header() {
8989
)}
9090
</div>
9191

92-
{/* NJ: We force all chats to be temporary & disable exporting/sharing */}
92+
{/* NJ: We disable exporting/sharing */}
9393
{!isSmallScreen && false && (
9494
<div className="flex items-center gap-2">
9595
<ExportAndShareMenu

client/src/components/Nav/Nav.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ const Nav = memo(
237237
isSmallScreen={isSmallScreen}
238238
/>
239239
<div className="flex min-h-0 flex-grow flex-col overflow-hidden">
240-
<TemporaryChatNotice />
241240
<Conversations
242241
conversations={conversations}
243242
moveToTop={moveToTop}

client/src/nj/components/TemporaryChatNotice.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

client/src/nj/components/info/NewJerseyGuidePage.tsx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export default function NewJerseyGuidePage() {
9999
<span className="font-bold">Smarter responses</span> — Powered by an upgraded AI model
100100
with knowledge through October 2025
101101
</li>
102+
<li className="mb-2">
103+
<span className="font-bold">Chat history</span> — See past chats, and continue chats of a
104+
particular topic in the same conversation thread
105+
</li>
102106
<li className="mb-2">
103107
<span className="font-bold">Visible reasoning</span> — Responses now include a
104108
&#34;thoughts&#34; section that shows the assistant&#39;s reasoning. Reviewing this can
@@ -188,23 +192,6 @@ export default function NewJerseyGuidePage() {
188192
</li>
189193
</ul>
190194

191-
<p className="mb-2 font-bold">What are temporary chats?</p>
192-
<p className="mb-6">
193-
Temporary chats work like regular conversations with one key difference: they are
194-
automatically deleted at midnight each day.
195-
</p>
196-
<p className="mb-6">
197-
You can start a conversation in the morning, return to it throughout the day, and pick up
198-
where you left off—closing your browser tab, navigating away, or refreshing the page
199-
won&#39;t affect your chat. Your recent conversations will also appear in the sidebar for
200-
easy access.
201-
</p>
202-
<p className="mb-6">
203-
At midnight, all conversations and sidebar history are cleared from the site and its
204-
database. Due to legal and security requirements around data retention, we are not able to
205-
offer permanent chat history at this time.
206-
</p>
207-
208195
<p className="mb-2 font-bold">What file types can I upload?</p>
209196
<p className="mb-6">The following file types are supported</p>
210197
<ul className="mb-6 list-inside list-disc">
@@ -252,10 +239,16 @@ export default function NewJerseyGuidePage() {
252239
The data for the NJ AI Assistant is stored in a state-hosted database. Your prompts and
253240
responses are encrypted, and none of this information will be used as training data for AI
254241
models, due to the government-friendly terms of service we have with our service providers.
242+
</p>
243+
<p className="mb-6">
244+
Chat history, similar to other state work-related documents, is retained in accordance with
245+
state records retention policies. Consult with your agency’s records custodians for more
246+
information.
247+
</p>
248+
<p className="mb-6">
255249
For maintenance purposes, the Platform team and OIT can access the information stored in the
256-
database, and would only do this to resolve a bug or other app issues. (Chats are currently
257-
temporary, so all chats are deleted at midnight daily. Once they are deleted, they are
258-
permanently deleted.)
250+
database, and would only access this information in response to a user request to help with
251+
a technical issue.
259252
</p>
260253

261254
<p className="mb-2 font-bold">
@@ -387,7 +380,7 @@ export default function NewJerseyGuidePage() {
387380
target="_blank"
388381
rel="noreferrer"
389382
>
390-
Anthropic’s prompt engineering guide - including how to
383+
Anthropic’s prompt engineering guide
391384
</a>
392385
</li>
393386
<li className="mb-2">

client/src/nj/utils/tests/constRecoilState.spec.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -77,36 +77,6 @@ describe('constRecoilState Tests', () => {
7777
});
7878

7979
describe('Locked states', () => {
80-
test('isTemporary is locked to true', () => {
81-
render(
82-
<RecoilRoot>
83-
<TestRecoilState recoilState={store.isTemporary} clickState={false} />
84-
</RecoilRoot>,
85-
);
86-
87-
const button = screen.getByTestId('changeRecoilState');
88-
expect(button).toHaveAttribute('title', 'Recoil Value=true');
89-
90-
// Click button (which attempts to change the recoil state), but it should remain unchanged
91-
fireEvent.click(button);
92-
expect(button).toHaveAttribute('title', 'Recoil Value=true');
93-
});
94-
95-
test('defaultTemporaryChat is locked to true', () => {
96-
render(
97-
<RecoilRoot>
98-
<TestRecoilState recoilState={store.defaultTemporaryChat} clickState={false} />
99-
</RecoilRoot>,
100-
);
101-
102-
const button = screen.getByTestId('changeRecoilState');
103-
expect(button).toHaveAttribute('title', 'Recoil Value=true');
104-
105-
// Click button (which attempts to change the recoil state), but it should remain unchanged
106-
fireEvent.click(button);
107-
expect(button).toHaveAttribute('title', 'Recoil Value=true');
108-
});
109-
11080
test('search is locked to disabled', () => {
11181
const defaultState = {
11282
enabled: false,

client/src/store/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type SearchState = {
99
isTyping: boolean;
1010
};
1111

12-
// NJ: Since we're forcing all chats to be temporary, the search bar's presence makes no sense, so disable it
12+
// NJ: Disable the search bar until we actually support search (via Meili)
1313
export const search = constRecoilStateOpts<SearchState>({
1414
key: 'search',
1515
default: {

client/src/store/temporary.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { atomWithLocalStorage } from '~/store/utils';
2-
import { constRecoilState } from '~/nj/utils/constRecoilState';
32

4-
// NJ: We are forcing all chats to be temporary
5-
const isTemporary = constRecoilState('isTemporary', true);
6-
const defaultTemporaryChat = constRecoilState('defaultTemporaryChat', true);
3+
const isTemporary = atomWithLocalStorage('isTemporary', false);
4+
const defaultTemporaryChat = atomWithLocalStorage('defaultTemporaryChat', false);
75

86
export default {
97
isTemporary,

nj/infra/lib/ecs-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export class EcsStack extends cdk.Stack {
318318
const lifecycleRule: s3.LifecycleRule = {
319319
enabled: true,
320320
expiration: cdk.Duration.days(1),
321-
// prefix: "tmp/", // re-enable when temp file changes land
321+
prefix: "tmp/",
322322
}
323323

324324
const s3Bucket = new s3.Bucket(this, 'LibrechatFileBucket', {

nj/nj-librechat.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ fileStrategy: "s3"
1616
interface:
1717
customWelcome: 'NJ AI Assistant'
1818

19-
# Make sure temporary chats are available (but only retained the minimum amount of time, which is 1 hour)
20-
temporaryChat: true
21-
temporaryChatRetention: 1
19+
# Disable temporary chats (we need to retain data for OPRA)
20+
temporaryChat: false
2221

2322
# Since we only have limited endpoints, we disable the more elaborate model selector
2423
# (Instead, we define the model selection using `modelSpecs` below)

0 commit comments

Comments
 (0)