-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use client island for aisummary card
- Loading branch information
1 parent
e3c5c95
commit e5d6d26
Showing
4 changed files
with
45 additions
and
37 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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
<script setup lang="ts"> | ||
defineProps(['content']) | ||
import { type Ref, onMounted, ref } from 'vue' | ||
import { type ContextDataType, getBlogContext } from '@/composables/useDynablog' | ||
const props = defineProps({ | ||
id: Number, | ||
}) | ||
const data: Ref<ContextDataType | null> = ref(null) | ||
onMounted(async () => { | ||
if (props.id) | ||
data.value = await getBlogContext(props.id) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="rounded-lg mx-3 lg:mx-10 mt-6 p-5 w-full border-gray-300 border-2"> | ||
<div class="rounded-lg mx-auto max-w-[90%] mt-6 p-5 w-full border-gray-300 border-2"> | ||
<HeadTitle class="!text-lg"> | ||
AI ηζηζθ¦ | ||
</HeadTitle> | ||
<!-- <span class="w-full text-gray-600 dark:text-gray-300" style="font-size: 14.5px;">{{ obj.output }}</span> --> | ||
<span class="w-full text-gray-600 dark:text-gray-300" style="font-size: 14.5px;">{{ content }}</span> | ||
</HeadTitle><br> | ||
<span class="w-full text-gray-600 dark:text-gray-300" style="font-size: 14.5px;">{{ data?.aiSummary }}</span> | ||
</div> | ||
</template> |
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,18 @@ | ||
export interface ContextDataType { | ||
title: string | ||
id: number | ||
postLink: string | ||
likes: string | ||
aiSummary: string | ||
comments: object[] | ||
} | ||
|
||
export async function getBlogContext(id: number): Promise<ContextDataType | null> { | ||
const api_base = `https://dynablog.nickchen.top/api/blog/${id}/context` | ||
try { | ||
return await ((await fetch(api_base)).json()) | ||
} | ||
catch { | ||
return null | ||
} | ||
} |
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
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