Skip to content

Commit

Permalink
fix: nextjs example
Browse files Browse the repository at this point in the history
  • Loading branch information
CahidArda committed Jul 1, 2024
1 parent d4fddc8 commit ea80e4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/nextjs/server-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@upstash/rag-chat": "../../",
"@upstash/rag-chat": "^1.0.1",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18"
Expand Down
14 changes: 7 additions & 7 deletions examples/nextjs/server-actions/src/app/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { UpstashMessage } from "@upstash/rag-chat";
import { createServerActionStream } from "@upstash/rag-chat/rsc";
import type { UpstashMessage } from "@upstash/rag-chat";
import { createServerActionStream } from "@upstash/rag-chat/nextjs";
import { ragChat } from "./rag-chat";

export const server_chat = async ({ userMessage }: { userMessage: UpstashMessage }) => {
Expand All @@ -16,23 +16,23 @@ export const server_chat = async ({ userMessage }: { userMessage: UpstashMessage
export const server_add_data = async () => {
await Promise.all([
ragChat.context.add({
dataType: "text",
type: "text",
data: "Paris, the capital of France, is renowned for its iconic landmark, the Eiffel Tower, which was completed in 1889 and stands at 330 meters tall.",
}),
ragChat.context.add({
dataType: "text",
type: "text",
data: "The city is home to numerous world-class museums, including the Louvre Museum, housing famous works such as the Mona Lisa and Venus de Milo.",
}),
ragChat.context.add({
dataType: "text",
type: "text",
data: "Paris is often called the City of Light due to its significant role during the Age of Enlightenment and its early adoption of street lighting.",
}),
ragChat.context.add({
dataType: "text",
type: "text",
data: "The Seine River gracefully flows through Paris, dividing the city into the Left Bank and the Right Bank, each offering its own distinct atmosphere.",
}),
ragChat.context.add({
dataType: "text",
type: "text",
data: "Paris boasts a rich culinary scene, with a plethora of bistros, cafés, and Michelin-starred restaurants serving exquisite French cuisine.",
}),
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { UpstashMessage } from "@upstash/rag-chat";
import { readServerActionStream } from "@upstash/rag-chat/rsc";
import type { UpstashMessage } from "@upstash/rag-chat";
import { readServerActionStream } from "@upstash/rag-chat/nextjs";
import { useState } from "react";
import { server_add_data, server_chat } from "../actions";

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/server-actions/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chat } from "./components/Chat";
import { Chat } from "./components/chat";
import { ragChat } from "./rag-chat";

export default async function Page() {
Expand Down

0 comments on commit ea80e4f

Please sign in to comment.