Skip to content

Commit

Permalink
Merge pull request #2 from Yidadaa/main
Browse files Browse the repository at this point in the history
Upstream Sync
  • Loading branch information
SergeWilfried authored Jul 9, 2023
2 parents 4373343 + 332f3fb commit da29403
Show file tree
Hide file tree
Showing 24 changed files with 406 additions and 254 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s

![More](./docs/images/more.png)

## Translation

If you want to add a new translation, read this [document](./docs/translation.md).

## Donation

[Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa)
Expand Down
18 changes: 9 additions & 9 deletions app/client/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ export const ChatControllerPool = {
controllers: {} as Record<string, AbortController>,

addController(
sessionIndex: number,
messageId: number,
sessionId: string,
messageId: string,
controller: AbortController,
) {
const key = this.key(sessionIndex, messageId);
const key = this.key(sessionId, messageId);
this.controllers[key] = controller;
return key;
},

stop(sessionIndex: number, messageId: number) {
const key = this.key(sessionIndex, messageId);
stop(sessionId: string, messageId: string) {
const key = this.key(sessionId, messageId);
const controller = this.controllers[key];
controller?.abort();
},
Expand All @@ -26,12 +26,12 @@ export const ChatControllerPool = {
return Object.values(this.controllers).length > 0;
},

remove(sessionIndex: number, messageId: number) {
const key = this.key(sessionIndex, messageId);
remove(sessionId: string, messageId: string) {
const key = this.key(sessionId, messageId);
delete this.controllers[key];
},

key(sessionIndex: number, messageIndex: number) {
return `${sessionIndex},${messageIndex}`;
key(sessionId: string, messageIndex: string) {
return `${sessionId},${messageIndex}`;
},
};
14 changes: 8 additions & 6 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,14 @@ export class ChatGPTApi implements LLMApi {
const chatModels = resJson.data?.filter((m) => m.id.startsWith("gpt-"));
console.log("[Models]", chatModels);

return (
chatModels?.map((m) => ({
name: m.id,
available: true,
})) || []
);
if (!chatModels) {
return [];
}

return chatModels.map((m) => ({
name: m.id,
available: true,
}));
}
}
export { OpenaiPath };
2 changes: 1 addition & 1 deletion app/components/chat-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function ChatItem(props: {
count: number;
time: string;
selected: boolean;
id: number;
id: string;
index: number;
narrow?: boolean;
mask: Mask;
Expand Down
67 changes: 33 additions & 34 deletions app/components/chat.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,24 +240,39 @@
&:last-child {
animation: slide-in ease 0.3s;
}
}

&:hover {
.chat-message-actions {
opacity: 1;
transform: translateY(0px);
max-width: 100%;
height: 40px;
}
.chat-message-user {
display: flex;
flex-direction: row-reverse;

.chat-message-action-date {
opacity: 0.2;
}
.chat-message-header {
flex-direction: row-reverse;
}
}

.chat-message-user {
.chat-message-header {
margin-top: 20px;
display: flex;
flex-direction: row-reverse;
align-items: center;

.chat-message-actions {
display: flex;
box-sizing: border-box;
font-size: 12px;
align-items: flex-end;
justify-content: space-between;
transition: all ease 0.3s;
transform: scale(0.9) translateY(5px);
margin: 0 10px;
opacity: 0;
pointer-events: none;

.chat-input-actions {
display: flex;
flex-wrap: nowrap;
}
}
}

.chat-message-container {
Expand All @@ -270,6 +285,12 @@
.chat-message-edit {
opacity: 0.9;
}

.chat-message-actions {
opacity: 1;
pointer-events: all;
transform: scale(1) translateY(0);
}
}
}

Expand All @@ -278,7 +299,6 @@
}

.chat-message-avatar {
margin-top: 20px;
position: relative;

.chat-message-edit {
Expand Down Expand Up @@ -318,27 +338,6 @@
border: var(--border-in-light);
position: relative;
transition: all ease 0.3s;

.chat-message-actions {
display: flex;
box-sizing: border-box;
font-size: 12px;
align-items: flex-end;
justify-content: space-between;
transition: all ease 0.3s 0.15s;
transform: translateX(-5px) scale(0.9) translateY(30px);
opacity: 0;
height: 0;
max-width: 0;
position: absolute;
left: 0;
z-index: 2;

.chat-input-actions {
display: flex;
flex-wrap: nowrap;
}
}
}

.chat-message-action-date {
Expand Down
Loading

0 comments on commit da29403

Please sign in to comment.