- Add SessionManager class to handle PTY sessions with WebSocket connections. - Implement methods for creating, retrieving, and destroying sessions. - Handle PTY output and WebSocket messages for terminal interaction. - Ensure graceful session destruction and cleanup. feat: initialize web application with Next.js and Tailwind CSS - Create initial Next.js application structure with TypeScript support. - Set up Tailwind CSS for styling with custom theme configurations. - Add ESLint configuration for code quality and consistency. feat: implement chat API and UI components - Create chat API route to handle chat requests and responses. - Develop chat layout with sidebar, header, chat window, and input components. - Integrate Zustand for state management of conversations and messages. - Add utility functions for formatting dates and managing class names. chore: add environment variables and configuration files - Create .env.example for environment variable setup. - Add configuration files for PostCSS, Tailwind CSS, and TypeScript. - Set up package.json with necessary dependencies and scripts for development.
60 lines
1.2 KiB
TypeScript
60 lines
1.2 KiB
TypeScript
export type MessageRole = "user" | "assistant" | "system" | "tool";
|
|
|
|
export type MessageStatus = "pending" | "streaming" | "complete" | "error";
|
|
|
|
export interface TextContent {
|
|
type: "text";
|
|
text: string;
|
|
}
|
|
|
|
export interface ToolUseContent {
|
|
type: "tool_use";
|
|
id: string;
|
|
name: string;
|
|
input: Record<string, unknown>;
|
|
}
|
|
|
|
export interface ToolResultContent {
|
|
type: "tool_result";
|
|
tool_use_id: string;
|
|
content: string | ContentBlock[];
|
|
is_error?: boolean;
|
|
}
|
|
|
|
export type ContentBlock = TextContent | ToolUseContent | ToolResultContent;
|
|
|
|
export interface Message {
|
|
id: string;
|
|
role: MessageRole;
|
|
content: ContentBlock[] | string;
|
|
status: MessageStatus;
|
|
createdAt: number;
|
|
model?: string;
|
|
usage?: {
|
|
input_tokens: number;
|
|
output_tokens: number;
|
|
};
|
|
}
|
|
|
|
export interface Conversation {
|
|
id: string;
|
|
title: string;
|
|
messages: Message[];
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
model?: string;
|
|
}
|
|
|
|
export interface ToolDefinition {
|
|
name: string;
|
|
description: string;
|
|
input_schema: Record<string, unknown>;
|
|
}
|
|
|
|
export interface AppSettings {
|
|
theme: "light" | "dark" | "system";
|
|
model: string;
|
|
apiUrl: string;
|
|
streamingEnabled: boolean;
|
|
}
|