-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: enhance ParticipantView with chatroom integration and improved layout * feat: implement API endpoint to start individual session and manage group conversations * feat: sync the subtaskCompleted, create conversation when hitting start button Co-authored-by: JacobLinCool <jacob@csie.cool> * feat: handle the neccery doc, integrate the chatroom, fix some LLM bugs - Integrated audio recording functionality using MicVAD. - Added support for sending audio to a speech-to-text API for transcription. - Updated conversation handling to include audio messages. - Improved group and conversation data fetching with Firestore. - Enhanced UI to reflect real-time updates in group information and chat history. Co-authored-by: JacobLinCool <jacob@csie.cool> * refactor: edit some console log * fix: update initializeSession function to be asynchronous for codeDoc * style: center QR code and enhance session code display in HostView.svelte * refactor: update participant loading message and improve participant display in HostView.svelte * Update src/routes/api/session/[id]/group/[group_number]/conversations/[conv_id]/chat/+server.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: JacobLinCool <jacob@csie.cool> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Loading branch information
1 parent
fcf13d5
commit 1ffa745
Showing
10 changed files
with
597 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import { adminDb } from '../src/lib/server/firebase'; | ||
|
||
async function deleteAllConversationsInSession(sessionId: string) { | ||
try { | ||
// 1. 獲取所有群組 | ||
const groupsSnapshot = await adminDb | ||
.collection('sessions') | ||
.doc(sessionId) | ||
.collection('groups') | ||
.get(); | ||
|
||
// 2. 遍歷每個群組 | ||
for (const groupDoc of groupsSnapshot.docs) { | ||
// 3. 獲取該群組下所有的對話 | ||
const conversationsSnapshot = await groupDoc.ref.collection('conversations').get(); | ||
|
||
// 4. 刪除每個對話 | ||
const deletePromises = conversationsSnapshot.docs.map(async (doc) => { | ||
await doc.ref.delete(); | ||
console.log(`已刪除對話: ${doc.id} (群組 ${groupDoc.id})`); | ||
}); | ||
|
||
// 5. 等待該群組的所有刪除操作完成 | ||
await Promise.all(deletePromises); | ||
console.log(`群組 ${groupDoc.id} 的所有對話已刪除`); | ||
} | ||
|
||
console.log(`Session ${sessionId} 的所有對話刪除成功`); | ||
} catch (error) { | ||
console.error('刪除對話時發生錯誤:', error); | ||
} | ||
} | ||
|
||
// 使用方式:傳入要刪除的 session ID | ||
const sessionId = 'VJgvzmbRuWwqR8kH4MMz'; // 替換成要刪除的 session ID | ||
deleteAllConversationsInSession(sessionId).catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.