mirror of
https://github.com/langchain-ai/content-writer.git
synced 2026-07-01 21:34:17 -04:00
Merge branch 'main' into brace/fix-loading-onboarding
This commit is contained in:
+2
-3
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
import { WelcomeDialog } from "@/components/WelcomeDialog";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ASSISTANT_ID_COOKIE } from "@/constants";
|
||||
import { getCookie, setCookie } from "@/lib/cookies";
|
||||
import { useState } from "react";
|
||||
import { useRules } from "@/hooks/useRules";
|
||||
import { GeneratedRulesDialog } from "@/components/GeneratedRulesDialog";
|
||||
import { ContentComposerChatInterface } from "@/components/ContentComposer";
|
||||
@@ -72,6 +70,7 @@ export default function Home() {
|
||||
systemRules={systemRules}
|
||||
updateAssistantMetadata={updateAssistantMetadata}
|
||||
assistantId={assistantId}
|
||||
userId={userId}
|
||||
/>
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -145,6 +145,7 @@ export interface WelcomeDialogProps {
|
||||
setSystemRulesAndSave: (newSystemRules: string) => Promise<void>;
|
||||
setSystemRules: (newSystemRules: string) => void;
|
||||
assistantId: string | undefined;
|
||||
userId: string | undefined;
|
||||
updateAssistantMetadata: (
|
||||
assistantId: string,
|
||||
fields: { metadata: Record<string, any> }
|
||||
@@ -170,7 +171,7 @@ export function WelcomeDialog(props: WelcomeDialogProps) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleClose = () => {
|
||||
const handleClose = async () => {
|
||||
setCookie(HAS_SEEN_DIALOG, "true");
|
||||
void setSystemRulesAndSave(systemRules ?? "");
|
||||
if (assistantName || assistantDescription) {
|
||||
@@ -179,14 +180,19 @@ export function WelcomeDialog(props: WelcomeDialogProps) {
|
||||
"Unable to update assistant metadata: assistantId is undefined"
|
||||
);
|
||||
}
|
||||
void props.updateAssistantMetadata(props.assistantId, {
|
||||
if (!props.userId) {
|
||||
throw new Error("Can not save assistant if userId is undefined.");
|
||||
}
|
||||
|
||||
setOpen(false);
|
||||
await props.updateAssistantMetadata(props.assistantId, {
|
||||
metadata: {
|
||||
assistantName,
|
||||
assistantDescription,
|
||||
userId: props.userId,
|
||||
},
|
||||
});
|
||||
}
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const handleNext = () => {
|
||||
|
||||
Reference in New Issue
Block a user