Skip to content

Commit

Permalink
This patch introduces several significant changes across various comp…
Browse files Browse the repository at this point in the history
…onents related to a chat feature and other enhancements within a development environment. Here's a brief overview:

1. **Chat Feature Integration**: It adds a new chat feature with corresponding TypeScript interfaces, collections, and UI components to handle chat functionalities. This includes:
   - Defining chat-related interfaces (`Chat`, `Message`) and configurations (`ChatPluginConfig`).
   - Implementing a chat plugin (`ChatPlugin.ts`) to integrate chat functionality within the system.
   - Creating a custom context (`createCustomContext`) specifically for the chat feature to facilitate accessing chat-related settings and functionalities across the application.
   - Adding new UI components (`ChatUI`, `ConversationsList`, `ChatView`) to display and manage chats within the admin interface.

2. **TailwindCSS Configuration and PostCSS**: The patches include configuration files for TailwindCSS (`tailwind.config.cjs`) and PostCSS (`postcss.config.cjs`), indicating the use of TailwindCSS for styling the chat UI components.

3. **Build and Deployment Enhancements**: Changes in build configurations and scripts (`build.config.ts`, `build.preset.ts`) suggest an update or enhancement in the build process, potentially to accommodate the newly introduced chat feature and its dependencies.

4. **Integration with LLM (Large Language Models)**: The addition of LLM-related functionalities (`providers.ts`, `types.ts`) suggests the chat feature might leverage large language models for generating or processing chat messages, with support for different providers like `ollama` and `openai`.

5. **Utilization of Payload CMS Capabilities**: The modifications show an extensive use of Payload CMS's features (`payload-types.ts`, `importMap.js`, `admin/importMap.js`) to integrate the chat feature into the CMS's admin panel, including custom routes, collections, and admin components.

6. **Miscellaneous Enhancements**: The patch includes various other changes aimed at improving the application's functionality, configurability, and maintainability, such as adding utility functions (`radash` usage in `llm-utils`), updating dependencies, and enhancing type safety and documentation through TypeScript interfaces.

Overall, this patch represents a comprehensive effort to introduce a sophisticated chat feature into the application, leveraging modern web technologies and practices such as React, TypeScript, TailwindCSS, PostCSS, and Payload CMS, along with the integration of advanced language processing capabilities through LLM providers.
  • Loading branch information
awhiteside1 committed Sep 23, 2024
1 parent edbd325 commit 93a4e41
Show file tree
Hide file tree
Showing 9 changed files with 1,425 additions and 740 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"author": "",
"license": "ISC",
"devDependencies": {
"prettier": "^3.3.3",
"vite": "^5.4.5",
"vite-tsconfig-paths": "^5.0.1",
"@biomejs/biome": "^1.9.1",
"@tsconfig/next": "^2.0.3",
"@tsconfig/node-lts": "^20.1.3",
"payload": "beta",
"prettier": "^3.3.3",
"tsx": "^4.19.1",
"vitest": "^2.1.1",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"payload": "beta"
"vite": "^5.4.5",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.1"
},
"prettier": {}
}
15 changes: 0 additions & 15 deletions packages/chat/build.config.ts

This file was deleted.

41 changes: 0 additions & 41 deletions packages/chat/build.preset.ts

This file was deleted.

39 changes: 28 additions & 11 deletions packages/chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"type": "module",
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"files": ["dist/", "*.css"],
"sources": "src/index.ts",
"files": [
"dist/",
"*.css"
],
"exports": {
"./ChatView": {
"types": "./dist/ui/page/ChatView.d.ts",
"import": "./dist/ui/page/ChatView.mjs",
"types": "./src/ui/page/ChatView.ts",
"import": "./dist/ui/page/ChatView.js",
"default": "./dist/ui/page/ChatView.cjs"
},
".": {
Expand All @@ -19,34 +23,47 @@
"scripts": {
"test": "vitest --run",
"bench": "vitest --run bench",
"build:stub": "unbuild --stub",
"build": "unbuild --sourcemap",
"postinstall": "pnpm build:stub",
"build:ui": "vite build",
"build:plugin": "unbuild --sourcemaps",
"build": "pnpm build:plugin && pnpm build:ui",
"tailwind": "npx tailwindcss -i ./src/ui/tailwind.css -o ./dist/ui/tailwind.css"
},
"dependencies": {
"tsup": "^8.3.0",
"@payloadcms/next": "beta",
"@payloadcms/ui": "beta",
"@vitejs/plugin-react": "^4.3.1",
"@workspace/llm-utils": "workspace:*",
"defu": "^6.1.4",
"ollama": "^0.5.9",
"openai": "^4.61.1",
"pathe": "^1.1.2",
"postcss": "^8.4.47",
"radash": "^12.1.0",
"tailwindcss": "^3.4.12",
"type-fest": "^4.26.1",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12"
"vite-plugin-lib-inject-css": "^2.1.1",
"vite-plugin-node-polyfills": "^0.22.0"
},
"peerDependencies": {
"next": "^14.2.13",
"payload": "beta",
"react": "^18.3.1"
},
"devDependencies": {
"@types/react": "18.3.7"
"@types/react": "18.3.8",
"unbuild": "^2.0.0",
"vite-plugin-dts": "^4.2.1",
"vite-plugin-externalize-deps": "^0.8.0"
},
"unbuild": {
"sourcemap": true
"entries": [
"./src/index"
],
"sourcemap": true,
"declaration": "compatible",
"failOnWarn": false,
"rollup": {
"emitCJS": true
}
}
}
4 changes: 3 additions & 1 deletion packages/chat/src/ui/page/ChatView.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '../tailwind.css'

import type {AdminViewProps} from 'payload'
//@ts-ignore
// biome-ignore lint/style/useImportType: <explanation>
Expand Down Expand Up @@ -57,7 +59,7 @@ import {ConversationsList} from './ConversationsList'

return (
<>
<script src="https://cdn.tailwindcss.com"/>
{/*<script src="https://cdn.tailwindcss.com"/>*/}
<div
style={{
paddingLeft: 'var(--gutter-h)',
Expand Down
14 changes: 12 additions & 2 deletions packages/chat/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'
import { libInjectCss } from 'vite-plugin-lib-inject-css';
import dts from 'vite-plugin-dts'
import { externalizeDeps } from 'vite-plugin-externalize-deps'

import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [tsconfigPaths()],

plugins: [tsconfigPaths(), react(), libInjectCss(),externalizeDeps(), dts({copyDtsFiles:true, outDir:'dist', })],
build: {
outDir: 'dist/ui/page',
lib: {
entry: ['./src/ui/page/ChatView.tsx'],
formats: ['es', 'cjs']
},
},
test: {
globals: true,
},
Expand Down
3 changes: 3 additions & 0 deletions packages/llm-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"build": "unbuild",
"postinstall": "pnpm build:stub"
},
"peerDependencies": {
"payload": "beta"
},
"dependencies": {
"radash": "^12.1.0"
}
Expand Down
Binary file modified playground/db/playground.db
Binary file not shown.
Loading

0 comments on commit 93a4e41

Please sign in to comment.