Download packages/sdk/js/src/v2/data.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/sdk/js/src/v2/data.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/sdk/js/src/v2/data.ts
-
curl -L -o data.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/sdk/js/src/v2/data.ts
685 Bytes
| import type { Part, UserMessage } from "./client.js" | |
| export const message = { | |
| user(input: Omit<UserMessage, "role" | "time" | "id"> & { parts: Omit<Part, "id" | "sessionID" | "messageID">[] }): { | |
| info: UserMessage | |
| parts: Part[] | |
| } { | |
| const { parts: _parts, ...rest } = input | |
| const info: UserMessage = { | |
| ...rest, | |
| id: "asdasd", | |
| time: { | |
| created: Date.now(), | |
| }, | |
| role: "user", | |
| } | |
| return { | |
| info, | |
| parts: input.parts.map( | |
| (part) => | |
| ({ | |
| ...part, | |
| id: "asdasd", | |
| messageID: info.id, | |
| sessionID: info.sessionID, | |
| }) as Part, | |
| ), | |
| } | |
| }, | |
| } | |