From 17da9f8a1585b2bdcef22167d3161203d77c8d09 Mon Sep 17 00:00:00 2001
From: Stan Ke <156306548@qq.com>
Date: Mon, 26 Aug 2024 23:41:55 +0800
Subject: [PATCH] remove deprecated code
---
app/api/chat/openai/route.ts | 5 +-
app/chat/agent.tsx | 1 -
app/chat/page.tsx | 6 -
app/components/Carousel.tsx | 32 ++--
app/page.tsx | 11 +-
lib/ModelSetting.ts | 5 +-
lib/supabase.ts | 72 +++++++++
package.json | 2 +-
public/styles.css | 281 ++++++++++++++++++++++++++++++++++-
tsconfig.json | 5 +-
10 files changed, 376 insertions(+), 44 deletions(-)
create mode 100644 lib/supabase.ts
diff --git a/app/api/chat/openai/route.ts b/app/api/chat/openai/route.ts
index 97758e0..33fb833 100644
--- a/app/api/chat/openai/route.ts
+++ b/app/api/chat/openai/route.ts
@@ -34,7 +34,7 @@ export async function POST(request: Request) {
console.log(chunk.choices[0].delta);
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}
- return response;
+ return ;
} catch (error: any) {
const errorMessage = error.error?.message || "An unexpected error occurred";
const errorCode = error.status || 500;
@@ -42,9 +42,6 @@ export async function POST(request: Request) {
return new Response(JSON.stringify({ message: errorMessage }), {
status: errorCode,
- headers: {
- "Content-Type": "application/json",
- },
});
}
}
diff --git a/app/chat/agent.tsx b/app/chat/agent.tsx
index 1dcf919..a0f98ce 100644
--- a/app/chat/agent.tsx
+++ b/app/chat/agent.tsx
@@ -13,7 +13,6 @@ export function createAgent(): Agent {
id,
name: `Agent ${id}`,
content: 'This is the default agent content.',
- config: agentConfig, // 将agentConfig添加到新创建的Agent中
};
agents[id] = newAgent;
return newAgent;
diff --git a/app/chat/page.tsx b/app/chat/page.tsx
index 42d85bb..ca09fda 100644
--- a/app/chat/page.tsx
+++ b/app/chat/page.tsx
@@ -57,11 +57,6 @@ const Chat = () => {
setMessage(event.target.value);
};
- const handleKeyPress = (event) => {
- if (event.key === 'Enter') {
- sendMessage();
- }
- };
return (
@@ -127,7 +122,6 @@ const Chat = () => {
type="text"
value={message}
onChange={handleMessageChange}
- onKeyPress={handleKeyPress}
className="flex-1 p-2 border-2 border-gray-200 rounded-md"
placeholder="Type your message..."
/>
diff --git a/app/components/Carousel.tsx b/app/components/Carousel.tsx
index ca8090e..481f022 100644
--- a/app/components/Carousel.tsx
+++ b/app/components/Carousel.tsx
@@ -1,6 +1,5 @@
"use client";
-import Image from "next/image";
import { useEffect, useState } from "react";
import { ChevronLeft, ChevronRight } from "react-feather";
@@ -10,6 +9,7 @@ const Carousel = ({
autoSlideInterval = 4000,
}) => {
const [currentSlide, setCurrentSlide] = useState(0);
+
const handleNextSlide = () => {
let newSlide = currentSlide === slides.length - 1 ? 0 : currentSlide + 1;
setCurrentSlide(newSlide);
@@ -21,36 +21,37 @@ const Carousel = ({
};
useEffect(() => {
- if (!autoPlay) return () => clearInterval(slideInterval);
+ if (!autoPlay) return;
+
const slideInterval = setInterval(handleNextSlide, autoSlideInterval);
return () => clearInterval(slideInterval);
- }, [currentSlide]);
+ }, [currentSlide, autoPlay, autoSlideInterval]);
return (
-
+
{slides.map((slide, index) => (
-
+
))}
-
-
+
{slides.map((_slide, index) => (
);
};
-export default Carousel;
+
+export default Carousel;
\ No newline at end of file
diff --git a/app/page.tsx b/app/page.tsx
index 639f2a2..20a1f5d 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -27,11 +27,7 @@ export default function Home() {
- {/*
-
- {slides}
-
-
*/}
+
+
+
+ {slides}
+
+
diff --git a/lib/ModelSetting.ts b/lib/ModelSetting.ts
index fcd38a1..65095d1 100644
--- a/lib/ModelSetting.ts
+++ b/lib/ModelSetting.ts
@@ -1,5 +1,3 @@
-import { LLMID } from "@/types"
-
/**
* LLM 模型
*/
@@ -181,7 +179,6 @@ export interface ChatStreamPayload {
*/
temperature: number;
tool_choice?: string;
- tools?: ChatCompletionTool[];
/**
* @title 控制生成文本中最高概率的单个令牌
* @default 1
@@ -219,7 +216,7 @@ type ChatSettingLimits = {
MAX_CONTEXT_LENGTH: number
}
-export const CHAT_SETTING_LIMITS: Record
= {
+export const CHAT_SETTING_LIMITS= {
// ANTHROPIC MODELS
"claude-2.1": {
MIN_TEMPERATURE: 0.0,
diff --git a/lib/supabase.ts b/lib/supabase.ts
new file mode 100644
index 0000000..74c1822
--- /dev/null
+++ b/lib/supabase.ts
@@ -0,0 +1,72 @@
+// import { createClient } from "@supabase/supabase-js";
+
+// interface Client {
+// url?: string;
+// key?: string;
+// }
+
+// const client: Client = {
+// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
+// key: process.env.SUPABASE_ANON_KEY
+// };
+
+// if (!client.url || !client.key) {
+// throw new Error("Missing Supabase credentials");
+// }
+
+// export const supabaseClient = createClient(client.url!, client.key!);
+
+// import { NextPage } from "next";
+// import { useState } from "react";
+
+
+// const Embeddings: NextPage = () => {
+// const [urls, setUrls] = useState([]);
+// const [loading, setLoading] = useState(false);
+
+// const handleSubmit = async (e: React.FormEvent) => {
+// e.preventDefault();
+// setLoading(true);
+
+// const response = await fetch("/api/generate-embeddings", {
+// method: "POST",
+// headers: { "Content-Type": "application/json" },
+// body: JSON.stringify({ urls })
+// });
+
+// setLoading(false);
+
+// if (!response.ok) {
+// // Handle error
+// }
+// };
+
+// return (
+//
+//
+// Generate embeddings
+//
+//
+// Paste a list of URLs below to geneate embeddings using the OpenAI API, and add the embeddings to the Supabase embeddings table.
+//
+//
+// {loading &&
Loading...
}
+//
+// );
+// };
+
+// export default Embeddings;
\ No newline at end of file
diff --git a/package.json b/package.json
index 92225da..bc66b80 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
- "build": "tailwindcss -i ./app/globals.css -o ./public/styles.css && next build",
+ "build": "next build",
"start": "next start",
"lint": "next lint"
},
diff --git a/public/styles.css b/public/styles.css
index cd4a4e1..eefe905 100644
--- a/public/styles.css
+++ b/public/styles.css
@@ -544,6 +544,40 @@ video {
--tw-backdrop-sepia: ;
}
+.container {
+ width: 100%;
+}
+
+@media (min-width: 640px) {
+ .container {
+ max-width: 640px;
+ }
+}
+
+@media (min-width: 768px) {
+ .container {
+ max-width: 768px;
+ }
+}
+
+@media (min-width: 1024px) {
+ .container {
+ max-width: 1024px;
+ }
+}
+
+@media (min-width: 1280px) {
+ .container {
+ max-width: 1280px;
+ }
+}
+
+@media (min-width: 1536px) {
+ .container {
+ max-width: 1536px;
+ }
+}
+
.absolute {
position: absolute;
}
@@ -589,10 +623,32 @@ video {
margin-right: auto;
}
+.my-2 {
+ margin-top: 0.5rem;
+ margin-bottom: 0.5rem;
+}
+
+.my-4 {
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+}
+
+.mb-2 {
+ margin-bottom: 0.5rem;
+}
+
.mb-4 {
margin-bottom: 1rem;
}
+.mb-6 {
+ margin-bottom: 1.5rem;
+}
+
+.mb-8 {
+ margin-bottom: 2rem;
+}
+
.mb-auto {
margin-bottom: auto;
}
@@ -609,6 +665,10 @@ video {
display: flex;
}
+.grid {
+ display: grid;
+}
+
.h-1 {
height: 0.25rem;
}
@@ -629,10 +689,6 @@ video {
height: 1.5rem;
}
-.h-64 {
- height: 16rem;
-}
-
.h-full {
height: 100%;
}
@@ -681,8 +737,12 @@ video {
min-width: 12rem;
}
-.max-w-md {
- max-width: 28rem;
+.max-w-3xl {
+ max-width: 48rem;
+}
+
+.max-w-full {
+ max-width: 100%;
}
.flex-1 {
@@ -709,6 +769,10 @@ video {
cursor: pointer;
}
+.grid-cols-1 {
+ grid-template-columns: repeat(1, minmax(0, 1fr));
+}
+
.flex-row {
flex-direction: row;
}
@@ -717,6 +781,10 @@ video {
flex-direction: column;
}
+.flex-wrap {
+ flex-wrap: wrap;
+}
+
.items-center {
align-items: center;
}
@@ -745,6 +813,16 @@ video {
gap: 1rem;
}
+.gap-8 {
+ gap: 2rem;
+}
+
+.space-x-4 > :not([hidden]) ~ :not([hidden]) {
+ --tw-space-x-reverse: 0;
+ margin-right: calc(1rem * var(--tw-space-x-reverse));
+ margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
+}
+
.space-y-8 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
@@ -779,6 +857,11 @@ video {
border-radius: 0.375rem;
}
+.rounded-e-xl {
+ border-start-end-radius: 0.75rem;
+ border-end-end-radius: 0.75rem;
+}
+
.rounded-l-lg {
border-top-left-radius: 0.5rem;
border-bottom-left-radius: 0.5rem;
@@ -789,6 +872,10 @@ video {
border-bottom-right-radius: 0.5rem;
}
+.rounded-es-xl {
+ border-end-start-radius: 0.75rem;
+}
+
.border {
border-width: 1px;
}
@@ -805,6 +892,10 @@ video {
border-right-width: 2px;
}
+.border-t {
+ border-top-width: 1px;
+}
+
.border-solid {
border-style: solid;
}
@@ -814,21 +905,46 @@ video {
border-color: rgb(229 231 235 / var(--tw-border-opacity));
}
+.border-gray-700 {
+ --tw-border-opacity: 1;
+ border-color: rgb(55 65 81 / var(--tw-border-opacity));
+}
+
.bg-blue-500 {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
}
+.bg-gray-100 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
+}
+
.bg-gray-50 {
--tw-bg-opacity: 1;
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
}
+.bg-gray-700 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity));
+}
+
.bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
}
+.bg-purple-600 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(147 51 234 / var(--tw-bg-opacity));
+}
+
+.bg-purple-700 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(126 34 206 / var(--tw-bg-opacity));
+}
+
.bg-transparent {
background-color: transparent;
}
@@ -842,6 +958,20 @@ video {
--tw-bg-opacity: 0.5;
}
+.bg-gradient-to-r {
+ background-image: linear-gradient(to right, var(--tw-gradient-stops));
+}
+
+.from-purple-500 {
+ --tw-gradient-from: #a855f7 var(--tw-gradient-from-position);
+ --tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);
+ --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
+}
+
+.to-indigo-600 {
+ --tw-gradient-to: #4f46e5 var(--tw-gradient-to-position);
+}
+
.p-0 {
padding: 0px;
}
@@ -862,34 +992,110 @@ video {
padding: 1rem;
}
+.p-6 {
+ padding: 1.5rem;
+}
+
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
}
+.px-6 {
+ padding-left: 1.5rem;
+ padding-right: 1.5rem;
+}
+
+.py-10 {
+ padding-top: 2.5rem;
+ padding-bottom: 2.5rem;
+}
+
.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
+.py-20 {
+ padding-top: 5rem;
+ padding-bottom: 5rem;
+}
+
+.py-3 {
+ padding-top: 0.75rem;
+ padding-bottom: 0.75rem;
+}
+
.pr-2 {
padding-right: 0.5rem;
}
+.pt-8 {
+ padding-top: 2rem;
+}
+
.text-center {
text-align: center;
}
+.text-3xl {
+ font-size: 1.875rem;
+ line-height: 2.25rem;
+}
+
+.text-4xl {
+ font-size: 2.25rem;
+ line-height: 2.5rem;
+}
+
+.text-lg {
+ font-size: 1.125rem;
+ line-height: 1.75rem;
+}
+
+.text-sm {
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}
+
+.text-xl {
+ font-size: 1.25rem;
+ line-height: 1.75rem;
+}
+
+.font-bold {
+ font-weight: 700;
+}
+
+.font-semibold {
+ font-weight: 600;
+}
+
.text-gray-100 {
--tw-text-opacity: 1;
color: rgb(243 244 246 / var(--tw-text-opacity));
}
+.text-gray-400 {
+ --tw-text-opacity: 1;
+ color: rgb(156 163 175 / var(--tw-text-opacity));
+}
+
.text-gray-700 {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}
+.text-gray-900 {
+ --tw-text-opacity: 1;
+ color: rgb(17 24 39 / var(--tw-text-opacity));
+}
+
+.text-purple-600 {
+ --tw-text-opacity: 1;
+ color: rgb(147 51 234 / var(--tw-text-opacity));
+}
+
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
@@ -962,16 +1168,36 @@ video {
}
}
+.hover\:bg-gray-100:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
+}
+
.hover\:bg-gray-200:hover {
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}
+.hover\:bg-purple-700:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(126 34 206 / var(--tw-bg-opacity));
+}
+
+.hover\:bg-purple-800:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(107 33 168 / var(--tw-bg-opacity));
+}
+
.hover\:text-blue-500:hover {
--tw-text-opacity: 1;
color: rgb(59 130 246 / var(--tw-text-opacity));
}
+.hover\:text-white:hover {
+ --tw-text-opacity: 1;
+ color: rgb(255 255 255 / var(--tw-text-opacity));
+}
+
.active\:opacity-90:active {
opacity: 0.9;
}
@@ -987,12 +1213,41 @@ video {
background-color: rgb(23 23 26 / var(--tw-bg-opacity));
}
+:is(.dark .dark\:bg-gray-700) {
+ --tw-bg-opacity: 1;
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity));
+}
+
+:is(.dark .dark\:bg-gray-800) {
+ --tw-bg-opacity: 1;
+ background-color: rgb(31 41 55 / var(--tw-bg-opacity));
+}
+
+:is(.dark .dark\:text-gray-300) {
+ --tw-text-opacity: 1;
+ color: rgb(209 213 219 / var(--tw-text-opacity));
+}
+
:is(.dark .dark\:text-red-50) {
--tw-text-opacity: 1;
color: rgb(254 242 242 / var(--tw-text-opacity));
}
+:is(.dark .dark\:text-white) {
+ --tw-text-opacity: 1;
+ color: rgb(255 255 255 / var(--tw-text-opacity));
+}
+
+:is(.dark .dark\:shadow-gray-700) {
+ --tw-shadow-color: #374151;
+ --tw-shadow: var(--tw-shadow-colored);
+}
+
@media (min-width: 768px) {
+ .md\:mb-0 {
+ margin-bottom: 0px;
+ }
+
.md\:mt-96 {
margin-top: 24rem;
}
@@ -1000,4 +1255,18 @@ video {
.md\:min-h-96 {
min-height: 24rem;
}
+
+ .md\:w-1\/4 {
+ width: 25%;
+ }
+
+ .md\:grid-cols-2 {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+}
+
+@media (min-width: 1024px) {
+ .lg\:grid-cols-4 {
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ }
}
diff --git a/tsconfig.json b/tsconfig.json
index 1acc222..d9cdb41 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
- "target": "es5",
+ "target": "ES6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
@@ -10,6 +10,7 @@
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
+ "noImplicitAny": false,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
@@ -22,6 +23,6 @@
"@/*": ["./*"]
}
},
+ "exclude": ["node_modules","**/examples/*","lib/*"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
- "exclude": ["node_modules"]
}