mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 00:01:03 +08:00
Fix some chatUI stuff.
This commit is contained in:
parent
94fbf1551d
commit
62ecea8aa3
@ -1,7 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const provider = route.params.provider;
|
|
||||||
const slug = route.params.slug;
|
|
||||||
</script>
|
|
||||||
<template></template>
|
|
@ -3,14 +3,27 @@ import { History, Plus, Send } from "lucide-vue-next";
|
|||||||
import { Input } from "~/components/ui/input";
|
import { Input } from "~/components/ui/input";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const cookie = useCookie("lastChatId");
|
const cookie = useCookie("lastChatId");
|
||||||
const lastChatId = cookie.value;
|
const cookieChatId = cookie.value;
|
||||||
const message = ref();
|
const chatId = ref();
|
||||||
|
const inputMessage = ref();
|
||||||
const messages = ref([]);
|
const messages = ref([]);
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
console.log(lastChatId);
|
console.log(cookieChatId);
|
||||||
if (lastChatId) {
|
if (cookieChatId) {
|
||||||
|
} else {
|
||||||
|
const { data: checkUserChatId } = await useFetch(
|
||||||
|
"/api/ai/chat/actions/findUserChatId",
|
||||||
|
);
|
||||||
|
cookieChatId.value = checkUserChatId.value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
onMounted(async () => {
|
||||||
|
const {
|
||||||
|
data: getData,
|
||||||
|
pending,
|
||||||
|
error,
|
||||||
|
} = useFetch(`/api/ai/chat/${chatId.value}`);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-full">
|
<div class="flex flex-col h-full">
|
||||||
@ -48,16 +61,11 @@ onMounted(() => {
|
|||||||
<Input
|
<Input
|
||||||
class="flex-1 rounded-xl"
|
class="flex-1 rounded-xl"
|
||||||
placeholder="Type a message..."
|
placeholder="Type a message..."
|
||||||
v-ref="message"
|
v-model="inputMessage"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="pl-2 pr-2 mr-1 ml-1 bg-black text-white rounded-full hover:bg-gray-700 hover:translate-y-[-4px] transition-all duration-300 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:bg-color-500"
|
class="pl-2 pr-2 mr-1 ml-1 bg-black text-white rounded-full hover:bg-gray-700 hover:translate-y-[-4px] transition-all duration-300 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:bg-color-500"
|
||||||
:disabled="
|
:disabled="!inputMessage?.trim()"
|
||||||
() => {
|
|
||||||
if (!message) return false;
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<Send class="w-5 h-5" />
|
<Send class="w-5 h-5" />
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user