Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Disable session renaming when AI is busy
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Feb 12, 2024
1 parent 1206152 commit 86aa58c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,18 @@ const App = () => {
};

const handleRenameSession = (id: string, newTitle: string) => {
const _sessions = {
...sessions,
[id]: [
{ ...sessions[id][0], title: newTitle },
...sessions[id].slice(1),
],
};
dispatch(updateSessions(_sessions));
if (!ai.busy) {
const _sessions = {
...sessions,
[id]: [
{ ...sessions[id][0], title: newTitle },
...sessions[id].slice(1),
],
};
dispatch(updateSessions(_sessions));
} else {
sendUserAlert(t("App.handleRenameSession.not_available"), true);
}
};

const handleDeleteSession = (id: string) => {
Expand Down
3 changes: 3 additions & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"cancel_button": "Cancel",
"on_confirmed": "Conversation history deleted"
},
"handleRenameSession": {
"not_available": "AI is currently busy, please try renaming later"
},
"handlePurgeSessions": {
"confirm_message": "Are you sure you want to clear all conversation history?",
"confirm_title": "Confirm action",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"cancel_button": "取消",
"on_confirmed": "对话记录已删除"
},
"handleRenameSession": {
"not_available": "AI 正忙,请稍后再尝试重命名"
},
"handlePurgeSessions": {
"confirm_message": "确定要清空所有对话记录吗?",
"confirm_title": "确认操作",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"cancel_button": "取消",
"on_confirmed": "對話紀錄已刪除"
},
"handleRenameSession": {
"not_available": "AI 正忙,請稍後再嘗試重命名"
},
"handlePurgeSessions": {
"confirm_message": "確定要清空所有對話紀錄嗎?",
"confirm_title": "確認操作",
Expand Down

0 comments on commit 86aa58c

Please sign in to comment.