Skip to content

Commit deadd90

Browse files
committed
cr
1 parent 35c6c74 commit deadd90

File tree

5 files changed

+30
-48
lines changed

5 files changed

+30
-48
lines changed

frontend/app/components/ProgressToolUI.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const useProgressToolUI = () =>
4444
const { text, progress } = stepToProgressFields(input.args.step);
4545

4646
return (
47-
<div className="flex flex-row w-[500px] items-center justify-start gap-3 pb-4 ml-[-5px] mt-[16px]">
47+
<div className="flex flex-row w-[550px] items-center justify-start gap-3 pb-4 ml-[-5px] mt-[16px]">
4848
<Progress
4949
value={progress}
5050
indicatorClassName="bg-gray-700"

frontend/app/components/SelectedDocumentsToolUI.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,16 @@ const DocumentCard = ({ document }: { document: Document }) => {
4444
};
4545

4646
const DocumentCardTooltip = ({ document }: { document: Document }) => {
47-
const [isOpen, setIsOpen] = useState(true);
48-
4947
const description =
5048
document.metadata.description && document.metadata.description !== ""
5149
? document.metadata.description
5250
: document.page_content.slice(0, 250);
5351

5452
return (
5553
<TooltipProvider>
56-
<Tooltip
57-
defaultOpen
58-
delayDuration={0}
59-
open={isOpen}
60-
onOpenChange={setIsOpen}
61-
>
54+
<Tooltip defaultOpen delayDuration={0}>
6255
<TooltipTrigger asChild>
63-
<div
64-
onMouseEnter={() => {
65-
console.log("Mouse enter");
66-
setIsOpen(true);
67-
}}
68-
onMouseLeave={() => {
69-
console.log("Mouse leave");
70-
setIsOpen(false);
71-
}}
72-
>
73-
<DocumentCard document={document} />
74-
</div>
56+
<DocumentCard document={document} />
7557
</TooltipTrigger>
7658
<TooltipContent className="flex flex-col max-w-[600px] whitespace-pre-wrap">
7759
<div className="flex flex-col gap-1">

frontend/app/components/ui/assistant-ui/syntax-highlighter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const SyntaxHighlighter = makePrismAsyncLightSyntaxHighlighter({
1818
customStyle: {
1919
margin: 0,
2020
width: "100%",
21-
background: "transparent",
21+
background: "#2b2b2b",
2222
padding: "1.5rem 1rem",
2323
},
2424
});

frontend/app/hooks/useGraph.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export const createClient = () => {
1616

1717
const nodeToStep = (node: string) => {
1818
switch (node) {
19-
case "route_at_start_node":
19+
case "analyze_and_route_query":
2020
return 0;
21-
case "generate_questions":
21+
case "create_research_plan":
2222
return 1;
23-
case "research_node":
23+
case "conduct_research":
2424
return 2;
25-
case "generate":
25+
case "respond":
2626
return 3;
2727
default:
2828
return 0;
@@ -86,17 +86,17 @@ export function useGraph() {
8686
};
8787

8888
const getOrCreateThread = async () => {
89-
const assistantIdCookie = getCookie("oc_assistant_id");
89+
const assistantIdCookie = getCookie("clc_py_assistant_id");
9090
if (assistantIdCookie) {
9191
setAssistantId(assistantIdCookie);
9292
return;
9393
}
9494
const client = createClient();
9595
const assistant = await client.assistants.create({
96-
graphId: "agent",
96+
graphId: "chat",
9797
});
9898
setAssistantId(assistant.assistant_id);
99-
setCookie("oc_assistant_id", assistant.assistant_id);
99+
setCookie("clc_py_assistant_id", assistant.assistant_id);
100100
};
101101

102102
const streamMessage = async (params: GraphInput) => {
@@ -198,10 +198,10 @@ export function useGraph() {
198198
const node = chunk?.data?.metadata?.langgraph_node;
199199
if (
200200
[
201-
"route_at_start_node",
202-
"generate_questions",
203-
"research_node",
204-
"generate",
201+
"analyze_and_route_query",
202+
"create_research_plan",
203+
"conduct_research",
204+
"respond",
205205
].includes(node)
206206
) {
207207
setMessages((prevMessages) => {
@@ -235,7 +235,7 @@ export function useGraph() {
235235
});
236236
}
237237

238-
if (node === "generate") {
238+
if (node === "respond") {
239239
setMessages((prevMessages) => {
240240
const selectedDocumentsAIMessage = new AIMessage({
241241
content: "",
@@ -254,7 +254,7 @@ export function useGraph() {
254254
}
255255

256256
if (chunk.data.event === "on_chat_model_stream") {
257-
if (chunk.data.metadata.langgraph_node === "route_at_start_node") {
257+
if (chunk.data.metadata.langgraph_node === "analyze_and_route_query") {
258258
const message = chunk.data.data.chunk;
259259
const toolCallChunk = message.tool_call_chunks?.[0];
260260
fullRoutingStr += toolCallChunk?.args || "";
@@ -302,7 +302,7 @@ export function useGraph() {
302302
}
303303
}
304304

305-
if (chunk.data.metadata.langgraph_node === "general") {
305+
if (chunk.data.metadata.langgraph_node === "respond_to_general_query") {
306306
const message = chunk.data.data.chunk;
307307
setMessages((prevMessages) => {
308308
const existingMessageIndex = prevMessages.findIndex(
@@ -329,7 +329,7 @@ export function useGraph() {
329329
});
330330
}
331331

332-
if (chunk.data.metadata.langgraph_node === "generate_questions") {
332+
if (chunk.data.metadata.langgraph_node === "create_research_plan") {
333333
const message = chunk.data.data.chunk;
334334
generatingQuestionsMessageId = message.id;
335335
const toolCallChunk = message.tool_call_chunks?.[0];
@@ -405,7 +405,7 @@ export function useGraph() {
405405
}
406406
}
407407

408-
if (chunk.data.metadata.langgraph_node === "generate") {
408+
if (chunk.data.metadata.langgraph_node === "respond") {
409409
const message = chunk.data.data.chunk;
410410
setMessages((prevMessages) => {
411411
const existingMessageIndex = prevMessages.findIndex(
@@ -444,10 +444,10 @@ export function useGraph() {
444444

445445
if (chunk.data.event === "on_chain_end") {
446446
if (
447-
chunk.data.metadata.langgraph_node === "research_node" &&
447+
chunk.data.metadata.langgraph_node === "conduct_research" &&
448448
chunk.data.data?.output &&
449449
typeof chunk.data.data.output === "object" &&
450-
"sub_question" in chunk.data.data.output
450+
"question" in chunk.data.data.output
451451
) {
452452
setMessages((prevMessages) => {
453453
const foundIndex = prevMessages.findIndex(
@@ -466,9 +466,7 @@ export function useGraph() {
466466
if (toolCall.name === "generating_questions") {
467467
const updatedQuestions = toolCall.args.questions.map(
468468
(q: any) => {
469-
if (
470-
q.question === chunk.data.data.output.sub_question
471-
) {
469+
if (q.question === chunk.data.data.output.question) {
472470
return {
473471
...q,
474472
queries: chunk.data.data.output.queries,
@@ -509,7 +507,7 @@ export function useGraph() {
509507
}
510508

511509
if (
512-
["generate", "general", "more_info"].includes(
510+
["respond", "respond_to_general_query", "ask_for_more_info"].includes(
513511
chunk?.data?.metadata?.langgraph_node,
514512
)
515513
) {
@@ -544,14 +542,16 @@ export function useGraph() {
544542
});
545543
}
546544

547-
if (chunk.data.metadata.langgraph_node === "generate") {
545+
if (chunk.data.metadata.langgraph_node === "respond") {
548546
const inputDocuments = chunk.data.data.input.documents;
549-
const message = chunk.data.data.output.messages;
547+
const message = chunk.data.data.output.messages[0];
548+
console.log("setting messages respond", chunk);
550549
setMessages((prevMessages) => {
551550
const existingMessageIndex = prevMessages.findIndex(
552551
(pMsg) => pMsg.id === message.id,
553552
);
554553
if (existingMessageIndex !== -1) {
554+
console.log("message.content", message.content);
555555
const newMessageWithLinks = new AIMessage({
556556
...message,
557557
content: addDocumentLinks(message.content, inputDocuments),

frontend/app/hooks/useLocalStorage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function useLocalStorage(key: string, initialValue: StoredValue) {
1212
const item = window.localStorage.getItem(key);
1313
return item ? JSON.parse(item) : initialValue;
1414
} catch (error) {
15-
console.log(error);
15+
console.error(error);
1616
return initialValue;
1717
}
1818
});
@@ -25,7 +25,7 @@ export function useLocalStorage(key: string, initialValue: StoredValue) {
2525
setStoredValue(value);
2626
window.localStorage.setItem(key, JSON.stringify(value));
2727
} catch (error) {
28-
console.log(error);
28+
console.error(error);
2929
}
3030
};
3131
return [storedValue, setValue];

0 commit comments

Comments
 (0)