Skip to content

Commit

Permalink
return 404 if audiocast doesn't when attempting to download the content
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaughachukwuma committed Nov 11, 2024
1 parent 1c48a71 commit e11a937
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
10 changes: 8 additions & 2 deletions api/src/utils/get_audiocast.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ def get_audiocast(session_id: str):
"""
Get audiocast based on session id
"""
storage_manager = StorageManager()
filepath = storage_manager.download_from_gcs(session_id)
try:
storage_manager = StorageManager()
filepath = storage_manager.download_from_gcs(session_id)
except Exception as e:
raise HTTPException(
status_code=404,
detail=f"Audiocast asset not found for session_id: {session_id}",
)

session_data = SessionManager(session_id).data()
if not session_data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@
$audioSource$ = response;
}
async function onstartNew() {
return goto('/', { invalidateAll: true, replaceState: true });
}
</script>

<div>
<slot {ongenerate} {onreviewSource} {onstartNew}></slot>
<slot {ongenerate} {onreviewSource}></slot>
</div>
File renamed without changes.
9 changes: 1 addition & 8 deletions app/src/lib/components/CheckFinalResponse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
export let content: string;
const dispatch = createEventDispatcher<{
startNew: void;
reviewSource: { summary: string };
generate: { summary: string };
}>();
Expand All @@ -37,7 +36,7 @@
>
</div>
{:else}
<div class="animate-fade-in grid sm:grid-cols-3 gap-3">
<div class="animate-fade-in grid sm:grid-cols-2 gap-3">
<Button
class="bg-emerald-600 text-emerald-100 hover:bg-emerald-700"
on:click={() => dispatch('generate', { summary: getSummary() })}>Generate Audiocast</Button
Expand All @@ -54,11 +53,5 @@
Review Source
</Button>
{/if}

<Button
variant="ghost"
class="text-emerald-600 hover:text-emerald-600 hover:bg-gray-800/40"
on:click={() => dispatch('startNew')}>Start New Session</Button
>
</div>
{/if}
2 changes: 1 addition & 1 deletion app/src/lib/components/RenderAudioSource.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<Drawer.Root {snapPoints} bind:activeSnapPoint direction="bottom" dismissible shouldScaleBackground>
<Drawer.Trigger>
<Button variant="ghost" class="bg-gray-800 hover:bg-gray-700 text-white"
<Button variant="ghost" class="bg-gray-800 w-full hover:bg-gray-700 text-white"
>Manage Audiocast Sources
</Button>
</Drawer.Trigger>
Expand Down
7 changes: 3 additions & 4 deletions app/src/routes/chat/[sessionId=sessionId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import ChatContainer from '@/components/ChatContainer.svelte';
import { getSessionContext, type ChatItem } from '@/stores/sessionContext.svelte.js';
import ChatListItem from '@/components/chat-list/ChatListItem.svelte';
import ChatListItem from '@/components/ChatListItem.svelte';
import { env } from '@env';
import { uuid } from '@/utils/uuid';
import { streamingResponse } from '$lib/utils/streamingResponse';
import CheckFinalResponse, {
FINAL_RESPONSE_SUFFIX
} from '@/components/CheckFinalResponse.svelte';
import ChatListActionItems from '@/components/chat-list/ChatListActionItems.svelte';
import ChatListActionItems from '@/components/ChatListActionItems.svelte';
import { onMount } from 'svelte';
import { debounce } from 'throttle-debounce';
import Spinner from '@/components/Spinner.svelte';
Expand Down Expand Up @@ -102,13 +102,12 @@
<ChatListItem type={item.role} content={item.content} loading={item.loading} />

{#if finalResponse}
<ChatListActionItems {sessionId} let:ongenerate let:onreviewSource let:onstartNew>
<ChatListActionItems {sessionId} let:ongenerate let:onreviewSource>
{#if $fetchingSource$}
<Spinner />
{:else}
<CheckFinalResponse
content={item.content}
on:startNew={onstartNew}
on:generate={({ detail }) => ongenerate(detail.summary)}
on:reviewSource={({ detail }) => onreviewSource(category, detail.summary)}
/>
Expand Down

0 comments on commit e11a937

Please sign in to comment.