Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions agent_chat/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# For inference
RESTACK_API_KEY=

# For Restack Cloud deployment
RESTACK_ENGINE_ID=
RESTACK_ENGINE_ADDRESS=
RESTACK_ENGINE_API_KEY=
RESTACK_ENGINE_API_ADDRESS=

55 changes: 55 additions & 0 deletions agent_chat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Build stage
FROM node:20-bullseye AS builder

WORKDIR /app

# Install pnpm
RUN npm install -g pnpm

# Copy package files and env file if it exists
COPY package*.json .env* ./

# Copy package files
COPY package*.json ./

# Install dependencies including TypeScript
RUN pnpm install
RUN pnpm add -D typescript

# Copy source code
COPY . .

# Build TypeScript code
RUN pnpm run build

# Production stage
FROM node:20-bullseye

WORKDIR /app

# Install pnpm
RUN npm install -g pnpm

# Copy package files and built code
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist

# Install production dependencies only
RUN pnpm install --prod

# Define environment variables
ARG RESTACK_ENGINE_ID
ENV RESTACK_ENGINE_ID=${RESTACK_ENGINE_ID}

ARG RESTACK_ENGINE_ADDRESS
ENV RESTACK_ENGINE_ADDRESS=${RESTACK_ENGINE_ADDRESS}

ARG RESTACK_ENGINE_API_KEY
ENV RESTACK_ENGINE_API_KEY=${RESTACK_ENGINE_API_KEY}

ARG RESTACK_ENGINE_API_ADDRESS
ENV RESTACK_ENGINE_API_ADDRESS=${RESTACK_ENGINE_API_ADDRESS}

EXPOSE 3000

CMD ["node", "dist/services.js"]
Binary file added agent_chat/chat_post.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added agent_chat/chat_put.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added agent_chat/chat_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions agent_chat/eventWorkflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { client } from "./src/client";

export type EventInput = {
workflowId: string;
runId: string;
};

async function eventWorkflow(input: EventInput) {
try {
await client.sendWorkflowEvent({
event: {
name: "message",
input: { content: "Telle ma another one" },
},
workflow: {
workflowId: input.workflowId,
runId: input.runId,
},
});

await client.sendWorkflowEvent({
event: {
name: "end",
},
workflow: {
workflowId: input.workflowId,
runId: input.runId,
},
});

process.exit(0); // Exit the process successfully
} catch (error) {
console.error("Error sending event to workflow:", error);
process.exit(1); // Exit the process with an error code
}
}

eventWorkflow({
workflowId: "your-workflow-id",
runId: "your-run-id",
});
Loading