Download frontend/src/core/threads/utils.ts from yonagush/deerflow: direct link, hf CLI and curl.
- Browser
- Download file 660 Bytes
-
https://huggingface.co/spaces/yonagush/deerflow/resolve/main/frontend/src/core/threads/utils.ts
- Command line
-
hf download hf://spaces/yonagush/deerflow/frontend/src/core/threads/utils.ts
-
curl -L -o utils.ts https://huggingface.co/spaces/yonagush/deerflow/resolve/main/frontend/src/core/threads/utils.ts
660 Bytes
| import type { BaseMessage } from "@langchain/core/messages"; | |
| import type { AgentThread } from "./types"; | |
| export function pathOfThread(threadId: string) { | |
| return `/workspace/chats/${threadId}`; | |
| } | |
| export function textOfMessage(message: BaseMessage) { | |
| if (typeof message.content === "string") { | |
| return message.content; | |
| } else if (Array.isArray(message.content)) { | |
| return message.content.find((part) => part.type === "text" && part.text) | |
| ?.text as string; | |
| } | |
| return null; | |
| } | |
| export function titleOfThread(thread: AgentThread) { | |
| if (thread.values && "title" in thread.values) { | |
| return thread.values.title; | |
| } | |
| return "Untitled"; | |
| } | |