Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion app/api/chat-stream/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ export async function POST(req: NextRequest) {
}
}

export const runtime = "experimental-edge";
export const runtime = "edge";
2 changes: 2 additions & 0 deletions app/api/config/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export async function POST(req: NextRequest) {
needCode: serverConfig.needCode,
});
}

export const runtime = "edge";
4 changes: 2 additions & 2 deletions app/api/openai/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function makeRequest(req: NextRequest) {
},
{
status: 500,
}
},
);
}
}
Expand All @@ -30,4 +30,4 @@ export async function GET(req: NextRequest) {
return makeRequest(req);
}

export const runtime = "experimental-edge";
export const runtime = "edge";
2 changes: 2 additions & 0 deletions app/api/openai/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ import type {

export type ChatRequest = CreateChatCompletionRequest;
export type ChatResponse = CreateChatCompletionResponse;

export type Updater<T> = (updater: (value: T) => void) => void;
17 changes: 11 additions & 6 deletions app/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from "./button.module.scss";

export function IconButton(props: {
onClick?: () => void;
icon: JSX.Element;
icon?: JSX.Element;
text?: string;
bordered?: boolean;
shadow?: boolean;
Expand All @@ -26,11 +26,16 @@ export function IconButton(props: {
disabled={props.disabled}
role="button"
>
<div
className={styles["icon-button-icon"] + ` ${props.noDark && "no-dark"}`}
>
{props.icon}
</div>
{props.icon && (
<div
className={
styles["icon-button-icon"] + ` ${props.noDark && "no-dark"}`
}
>
{props.icon}
</div>
)}

{props.text && (
<div className={styles["icon-button-text"]}>{props.text}</div>
)}
Expand Down
20 changes: 17 additions & 3 deletions app/components/chat-list.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import DeleteIcon from "../icons/delete.svg";
import BotIcon from "../icons/bot.svg";

import styles from "./home.module.scss";
import {
DragDropContext,
Expand Down Expand Up @@ -35,17 +37,29 @@ export function ChatItem(props: {
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
title={`${props.title}\n${Locale.ChatItem.ChatItemCount(
props.count,
)}`}
>
{props.narrow ? (
<div className={styles["chat-item-narrow"]}>{props.count}</div>
<div className={styles["chat-item-narrow"]}>
<div className={styles["chat-item-avatar"] + " no-dark"}>
<BotIcon></BotIcon>
</div>
<div className={styles["chat-item-narrow-count"]}>
{props.count}
</div>
</div>
) : (
<>
<div className={styles["chat-item-title"]}>{props.title}</div>
<div className={styles["chat-item-info"]}>
<div className={styles["chat-item-count"]}>
{Locale.ChatItem.ChatItemCount(props.count)}
</div>
<div className={styles["chat-item-date"]}>{props.time}</div>
<div className={styles["chat-item-date"]}>
{new Date(props.time).toLocaleString()}
</div>
</div>
</>
)}
Expand Down Expand Up @@ -99,7 +113,7 @@ export function ChatList(props: { narrow?: boolean }) {
{sessions.map((item, i) => (
<ChatItem
title={item.topic}
time={item.lastUpdate}
time={new Date(item.lastUpdate).toLocaleString()}
count={item.messages.length}
key={item.id}
id={item.id}
Expand Down
36 changes: 19 additions & 17 deletions app/components/chat.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@
}
}

.section-title {
font-size: 12px;
font-weight: bold;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;

.section-title-action {
display: flex;
align-items: center;
}
}

.context-prompt {
.context-prompt-row {
display: flex;
Expand Down Expand Up @@ -81,25 +95,13 @@
}

.memory-prompt {
margin-top: 20px;

.memory-prompt-title {
font-size: 12px;
font-weight: bold;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;

.memory-prompt-action {
display: flex;
align-items: center;
}
}
margin: 20px 0;

.memory-prompt-content {
background-color: var(--gray);
border-radius: 6px;
background-color: var(--white);
color: var(--black);
border: var(--border-in-light);
border-radius: 10px;
padding: 10px;
font-size: 12px;
user-select: text;
Expand Down
Loading