Compare commits

..

4 Commits

Author SHA1 Message Date
github-actions[bot] fc1bedf438 Release (#1794)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-28 15:22:44 +07:00
Thuc Pham 164cf7a6df fix: custom next server start fail (#1795) 2025-03-28 15:09:57 +07:00
Zhanghao e98033e2cc docs: correct the number of indexes (#1793) 2025-03-27 16:33:52 +02:00
dependabot[bot] c0ffc7b434 chore(deps-dev): bump vite from 5.4.14 to 5.4.15 (#1787)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-26 20:43:49 +07:00
23 changed files with 589 additions and 85 deletions
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/doc
## 0.2.2
### Patch Changes
- e98033e: docs: correct the number of indexes
## 0.2.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@llamaindex/doc",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"scripts": {
"postinstall": "fumadocs-mdx",
@@ -2,7 +2,7 @@
title: Index
---
An index is the basic container and organization for your data. LlamaIndex.TS supports two indexes:
An index is the basic container and organization for your data. LlamaIndex.TS supports three indexes:
- `VectorStoreIndex` - will send the top-k `Node`s to the LLM when generating a response. The default top-k is 2.
- `SummaryIndex` - will send every `Node` in the index to the LLM in order to generate a response
@@ -10,7 +10,7 @@
},
"devDependencies": {
"typescript": "^5.7.3",
"vite": "^5.4.12",
"vite": "^5.4.15",
"vite-plugin-wasm": "^3.3.0"
},
"dependencies": {
@@ -16,7 +16,7 @@
"@size-limit/preset-big-lib": "^11.1.6",
"size-limit": "^11.1.6",
"typescript": "^5.7.3",
"vite": "^6.1.0"
"vite": "^5.4.15"
},
"dependencies": {
"llamaindex": "workspace:*"
+6
View File
@@ -1,5 +1,11 @@
# @llamaindex/server
## 0.0.4
### Patch Changes
- 164cf7a: fix: custom next server start fail
## 0.0.3
### Patch Changes
@@ -1,3 +1,5 @@
"use client";
export default function Header() {
return (
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
@@ -1,3 +1,5 @@
"use client";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";
+20 -19
View File
@@ -1,22 +1,23 @@
import * as React from "react";
"use client";
import { forwardRef } from "react";
import { cn } from "./lib/utils";
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-xl border border-neutral-200 bg-white text-neutral-950 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
className,
)}
{...props}
/>
));
const Card = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-xl border border-neutral-200 bg-white text-neutral-950 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
className,
)}
{...props}
/>
),
);
Card.displayName = "Card";
const CardHeader = React.forwardRef<
const CardHeader = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
@@ -28,7 +29,7 @@ const CardHeader = React.forwardRef<
));
CardHeader.displayName = "CardHeader";
const CardTitle = React.forwardRef<
const CardTitle = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
@@ -40,7 +41,7 @@ const CardTitle = React.forwardRef<
));
CardTitle.displayName = "CardTitle";
const CardDescription = React.forwardRef<
const CardDescription = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
@@ -52,7 +53,7 @@ const CardDescription = React.forwardRef<
));
CardDescription.displayName = "CardDescription";
const CardContent = React.forwardRef<
const CardContent = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
@@ -60,7 +61,7 @@ const CardContent = React.forwardRef<
));
CardContent.displayName = "CardContent";
const CardFooter = React.forwardRef<
const CardFooter = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
@@ -1,3 +1,5 @@
"use client";
import { useChatMessage } from "@llamaindex/chat-ui";
import { User2 } from "lucide-react";
@@ -1,3 +1,5 @@
"use client";
import { ChatMessage } from "@llamaindex/chat-ui";
import { DeepResearchCard } from "./custom/deep-research-card";
import { ToolAnnotations } from "./tools/chat-tools";
@@ -1,3 +1,5 @@
"use client";
import { useChatUI } from "@llamaindex/chat-ui";
import { StarterQuestions } from "@llamaindex/chat-ui/widgets";
import { getConfig } from "../lib/utils";
@@ -1,3 +1,5 @@
"use client";
import { useChatUI } from "@llamaindex/chat-ui";
import { Loader2 } from "lucide-react";
import { useCallback, useEffect, useState } from "react";
@@ -1,3 +1,5 @@
"use client";
import { SourceData } from "@llamaindex/chat-ui";
import { Markdown as MarkdownUI } from "@llamaindex/chat-ui/widgets";
import { getConfig } from "../../lib/utils";
@@ -1,3 +1,5 @@
"use client";
import {
Message,
MessageAnnotation,
@@ -1,3 +1,5 @@
"use client";
export interface WeatherData {
latitude: number;
longitude: number;
+1 -1
View File
@@ -1,8 +1,8 @@
"use client";
import Header from "@/app/components/header";
import { Loader2 } from "lucide-react";
import dynamic from "next/dynamic";
import Header from "./components/header";
const ChatSection = dynamic(() => import("./components/chat-section"), {
ssr: false,
+7 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@llamaindex/server",
"description": "LlamaIndex Server",
"version": "0.0.3",
"version": "0.0.4",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -31,7 +31,8 @@
"prebuild": "pnpm clean",
"build": "bunchee",
"postbuild": "pnpm copy:next-src && pnpm build:static && pnpm copy:static",
"copy:next-src": "cp -r ./next ./server",
"copy:next-src": "cp -r ./next ./server && pnpm build:css && rm -rf ./server/postcss.config.js",
"build:css": "postcss server/app/globals.css -o server/app/globals.css",
"build:static": "cd ./next && next build",
"copy:static": "cp -r ./next/out ./dist/static",
"dev": "bunchee --watch"
@@ -47,10 +48,13 @@
"eslint": "^9",
"eslint-config-next": "15.2.3",
"@eslint/eslintrc": "^3",
"tsx": "^4.19.3"
"tsx": "^4.19.3",
"postcss": "^8.5.3",
"postcss-cli": "^11.0.1"
},
"dependencies": {
"ai": "^4.2.0",
"@llamaindex/env": "workspace:*",
"llamaindex": "workspace:*",
"next": "15.2.3",
"react": "^19.0.0",
+86
View File
@@ -0,0 +1,86 @@
import { randomUUID } from "@llamaindex/env";
import {
MetadataMode,
WorkflowEvent,
type Metadata,
type NodeWithScore,
} from "llamaindex";
// Events that appended to stream as annotations
export type SourceEventNode = {
id: string;
metadata: Metadata;
score: number | null;
url: string;
text: string;
};
export type SourceEventData = {
nodes: SourceEventNode[];
};
export class SourceEvent extends WorkflowEvent<{
type: "sources";
data: SourceEventData;
}> {}
export type AgentRunEventData = {
agent: string;
text: string;
type: "text" | "progress";
data?: { id: string; total: number; current: number } | undefined;
};
export class AgentRunEvent extends WorkflowEvent<{
type: "agent";
data: AgentRunEventData;
}> {}
export function toSourceEventNode(
node: NodeWithScore<Metadata>,
fileUrlPrefix: string = "/api/files/data",
) {
return {
id: node.node.id_,
metadata: node.node.metadata,
score: node.score ?? null,
url: `${fileUrlPrefix}/${node.node.metadata.file_name}`,
text: node.node.getContent(MetadataMode.NONE),
};
}
export function toSourceEvent(
sourceNodes: NodeWithScore<Metadata>[] = [],
fileUrlPrefix: string = "/api/files/data",
) {
const nodes: SourceEventNode[] = sourceNodes.map((node) =>
toSourceEventNode(node, fileUrlPrefix),
);
return new SourceEvent({
type: "sources",
data: { nodes },
});
}
export function toAgentRunEvent(input: {
agent: string;
text: string;
type: "text" | "progress";
current?: number;
total?: number;
}) {
return new AgentRunEvent({
type: "agent",
data: {
...input,
data:
input.total && input.total > 1
? {
id: randomUUID(),
current: input.current ?? 1,
total: input.total,
}
: undefined,
},
});
}
+1 -1
View File
@@ -9,7 +9,7 @@ export const handleServeFiles = async (
pathname: string,
) => {
const filePath = pathname.substring("/api/files/".length);
if (!filePath.startsWith("output")) {
if (!filePath.startsWith("output") && !filePath.startsWith("data")) {
return sendJSONResponse(res, 400, { error: "No permission" });
}
const decodedFilePath = decodeURIComponent(filePath);
+1
View File
@@ -1,2 +1,3 @@
export * from "./events";
export * from "./server";
export * from "./types";
+5 -5
View File
@@ -1,8 +1,8 @@
import type {
AgentInputData,
AgentWorkflow,
AgentWorkflowContext,
Workflow,
import {
type AgentInputData,
type AgentWorkflow,
type AgentWorkflowContext,
type Workflow,
} from "llamaindex";
import type next from "next";
+434 -52
View File
File diff suppressed because it is too large Load Diff