Skip to content

Fix chat api streaming#65

Open
khaosans wants to merge 32 commits intomainfrom
fix-chat-api-streaming
Open

Fix chat api streaming#65
khaosans wants to merge 32 commits intomainfrom
fix-chat-api-streaming

Conversation

@khaosans
Copy link
Member

No description provided.

This commit updates the supabase types in the `types.ts` file and adds task-related functions in the `mutations.ts` file. It also creates the `tasks` table in the database and sets up row-level security policies for tasks. These changes improve the organization and functionality of the codebase.
- Updated the subscription in the chat stream route to use the supabase channel instead of the deprecated method.
- Added a filter to only receive INSERT events for messages with type 'intermediate' and matching chat_id.
- Enqueued the data payload for intermediate messages to the controller.

fix: Fix viewport settings in layout.tsx

- Removed unnecessary viewport properties from the metadata object in layout.tsx.
- Set the userScalable property to false in the viewport object.

refactor: Remove unnecessary newlines at end of files

- Removed unnecessary newlines at the end of files to improve code readability.
…d functions

- Update supabase subscription in chat stream route
- Update supabase types and add task-related functions
- Add OpenAIStream and StreamingTextResponse imports
- Create stream and handle intermediate responses
- Save messages to the database
- Return a StreamingTextResponse in POST route
- Update experimental serverActions in next.config.js
- Add @testing-library/jest-dom to tsconfig.json types
…d functions

- Update supabase subscription and types
- Add task-related functions
This commit adds new hooks for handling local storage and window size in the codebase. These hooks will provide convenient abstractions for accessing and manipulating local storage data and monitoring changes in the window size. This will improve the overall functionality and user experience of the application.
This commit adds new hooks for local storage and window size. These hooks will be used to handle storage and window-related functionality in the application.
- Refactor the message component to include new functionality for displaying attachments and wallet information.
- Add a new component, ImageWithFallback, to handle image loading and error handling.
- Introduce a new state variable, showActions, to control the visibility of message actions.
- Implement a dropdown menu for user messages with options to copy and delete the message.
- Add suggested actions to the multimodal input component for easier user interaction.
Add the OpenAIStreamConfig interface to the types.ts file to define the configuration options for the OpenAI stream.

refactor: Update elron-ai.code-workspace

Update the elron-ai.code-workspace file to include additional project folders.

chore: Update package.json

Add the eventsource-parser dependency to the package.json file.

feat: Add getOpenAIConfig function

Add the getOpenAIConfig function to the openai-config.ts file to retrieve the OpenAI API key.

feat: Update route.ts

Update the route.ts file to include two new OpenAI models: GPT-4O Mini and GPT-4O.

feat: Update site.webmanifest

Update the site.webmanifest file to include a description and icons for the Elron AI chatbot.

chore: Update pnpm-lock.yaml

Add the eventsource-parser dependency to the pnpm-lock.yaml file.

feat: Add OpenAIStream function

Add the OpenAIStream function to the openai-stream.ts file to handle streaming responses from the OpenAI API.

refactor: Update layout.tsx

Update the layout.tsx file to include additional icons and theme color options.
…rfaces

This commit adds three new interfaces: WeatherParams, CryptoPriceParams, and FunctionResponse. These interfaces are used to define the types of parameters and response data for different functions in the application.

The WeatherParams interface includes properties for location and an optional unit of temperature measurement.

The CryptoPriceParams interface includes properties for a cryptocurrency symbol and an optional currency.

The FunctionResponse interface defines the structure of the response data for various functions, including a success flag, optional data, and an optional error message.

These interfaces will be used to ensure type safety and provide clear documentation for the functions that use them.
…r, supabase types, card, badge, useTaskManager, chat, scroll-area, langchain task-manager, task-list, and scroll-area components
Add the SettingsProvider component to provide a context for managing application settings. This component allows users to customize the theme, font size, and notifications. It also includes a function to update the settings based on user preferences.
…Processor, supabase types, card, badge, useTaskManager, chat, scroll-area, langchain task-manager, task-list, and scroll-area components"

This reverts commit 8ac6988.
refactor: Update ChatPage component to use optional searchParams

This commit updates the ChatPage component to use optional searchParams in the PageProps interface. This change allows for flexibility when passing search parameters to the component.
@vercel
Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
elron-ai ❌ Failed (Inspect) Nov 28, 2024 5:26am

- Update the code in `route.ts` to replace the usage of `OPENAI_API_KEY` with `NEXT_PUBLIC_OPENAI_API_KEY` for improved security and accessibility.

feat: Add unit tests for SettingsProvider component

- Add unit tests for the `SettingsProvider` component to ensure its functionality and prevent regressions.

chore: Update package.json and pnpm-lock.yaml

- Update the `package.json` and `pnpm-lock.yaml` files to include new dependencies and their versions.
This commit updates the chat API route in the code and adds rate limiting functionality to prevent abuse. It also includes changes to the logger function and implements functions for fetching current weather and crypto prices with retry logic. The commit also updates the usage of the OpenAI API key to use the NEXT_PUBLIC_OPENAI_API_KEY environment variable. Overall, these changes improve the reliability and security of the chat functionality.
Export the PageProps interface in the chat page to make it accessible for other modules. This change allows other parts of the codebase to import and use the PageProps interface when needed.
This commit updates the chat page to resolve the async params before fetching the chat data. This ensures that the correct chat ID is used when making the API call. The previous implementation was using the unresolved params, which could lead to incorrect data retrieval. This change improves the reliability and accuracy of the chat page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant