still broken chatbot.

This commit is contained in:
yuanhau 2025-05-13 23:09:11 +08:00
parent 784b45451e
commit d6fb71d460
12 changed files with 100 additions and 62 deletions

9
.prettierignore Normal file
View file

@ -0,0 +1,9 @@
.nuxt
.output
*.lock
*.md
.env
.env*
sentry*
package.json
node_modules

View file

@ -33,6 +33,8 @@ App Design: [PDF Document](/design.pdf)
- MacOS - MacOS
- Windows XP style X - UI - Windows XP style X - UI
- Ghostty - Ghostty
- Some random chat app embeded to most business websites
- Treble's cool card effect (but not quite yet)
## Stack: ## Stack:
@ -48,6 +50,7 @@ App Design: [PDF Document](/design.pdf)
- Custom Infra - Custom Infra
- Python - Python
- BeautifulSoup4 - BeautifulSoup4
- uv
## Folder Structure ## Folder Structure

View file

@ -24,10 +24,10 @@ import copyrightInfo from "~/components/app/info/copyright.vue";
></span ></span
> >
</div> </div>
<hr/> <hr />
<div class="flex flex-col"> <div class="flex flex-col">
<span class="text-xl">版權資訊</span> <span class="text-xl">版權資訊</span>
<copyrightInfo /> <copyrightInfo />
</div> </div>
</div> </div>
</template> </template>

View file

@ -7,10 +7,10 @@ const loading = ref(true);
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const props = defineProps({ const props = defineProps({
values: { values: {
type: String, type: String,
required: true, required: true,
} },
}); });
const { const {
@ -36,7 +36,6 @@ onMounted(() => {
scrambleText: fetchNewsOrgInfo.value?.title, scrambleText: fetchNewsOrgInfo.value?.title,
}); });
}); });
</script> </script>
<template> <template>
<div> <div>
@ -70,4 +69,4 @@ onMounted(() => {
</div> </div>
</div> </div>
</div> </div>
</template> </template>

View file

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { History, Plus, Send } from "lucide-vue-next"; 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 lastChatId = cookie.value;
const message = ref();
const messages = ref([]);
onMounted(() => { onMounted(() => {
console.log(lastChatId); console.log(lastChatId);
if (lastChatId) { if (lastChatId) {
@ -12,31 +14,50 @@ onMounted(() => {
</script> </script>
<template> <template>
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
<div class="justify-center align-center text-center flex flex-col"> <div>
<div class="flex flex-row justify-between"> <div class="justify-center align-center text-center flex flex-col">
<div>Chat Name</div> <div class="flex flex-row justify-between">
<div class="flex flex-row justify-center align-center text-center"> <h2 class="text-xl ml-4 text-bold">Chat Name</h2>
<div <div class="flex flex-row justify-center align-center text-center">
class="flex flex-row justify-center align-center text-center gap-2" <div
> class="flex flex-row justify-center align-center text-center gap-2"
<button class="p-2 rounded-t-xl hover:bg-gray-300 transition-all duration-400"> >
<History class="h-4 w-4" /> <button
</button> class="p-2 rounded-t-xl hover:bg-gray-300 transition-all duration-400"
<button class="p-2 rounded-t-xl hover:bg-gray-300 transition-all duration-400"> >
<Plus class="h-4 w-4" /> <History class="h-4 w-4" />
</button> </button>
<button
class="p-2 rounded-t-xl hover:bg-gray-300 transition-all duration-400"
>
<Plus class="h-4 w-4" />
</button>
</div>
</div>
</div> </div>
<hr />
</div>
<div
ref="chatContainerRef"
class="flex-1 overflow-y-auto p-4 space-y-4"
>
<div
v-for="message in messages"
class="max-w-[80%] rounded-lg p-3"
>
</div> </div>
</div> </div>
<hr />
<div ref="chatContainerRef" class="flex-1 overflow-y-auto p-4 space-y-4">
</div>
<div class="text-black w-full flex flex-row space-x-2">
<Input class="flex-1 rounded-xl" placeholder="Type a message..." <div class="text-black w-full flex flex-row space-x-2">
/> <Input class="flex-1 rounded-xl" placeholder="Type a message..." v-ref="message" />
<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" disabled="true"><Send class="w-5 h-5"/></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"
:disabled="() => {if (!message) return false; else return true;}"
>
<Send class="w-5 h-5" />
</button>
</div>
</div> </div>
</div> </div>
</div>
</template> </template>

View file

@ -2,12 +2,12 @@
import noImageLogo from "~/public/geterrorassets/noImageLogo.svg"; import noImageLogo from "~/public/geterrorassets/noImageLogo.svg";
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const emit = defineEmits(['windowopener', 'loadValue']) const emit = defineEmits(["windowopener", "loadValue"]);
const openNewWindow = (itemId: string) => { const openNewWindow = (itemId: string) => {
emit('windowopener', "aboutNewsOrg") emit("windowopener", "aboutNewsOrg");
emit('loadValue', itemId) emit("loadValue", itemId);
} };
const { const {
data: source, data: source,

View file

@ -1,3 +1 @@
<template> <template></template>
</template>

View file

@ -1,24 +1,32 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from "vue";
import { cn } from '@/lib/utils' import { cn } from "@/lib/utils";
import { useVModel } from '@vueuse/core' import { useVModel } from "@vueuse/core";
const props = defineProps<{ const props = defineProps<{
defaultValue?: string | number defaultValue?: string | number;
modelValue?: string | number modelValue?: string | number;
class?: HTMLAttributes['class'] class?: HTMLAttributes["class"];
}>() }>();
const emits = defineEmits<{ const emits = defineEmits<{
(e: 'update:modelValue', payload: string | number): void (e: "update:modelValue", payload: string | number): void;
}>() }>();
const modelValue = useVModel(props, 'modelValue', emits, { const modelValue = useVModel(props, "modelValue", emits, {
passive: true, passive: true,
defaultValue: props.defaultValue, defaultValue: props.defaultValue,
}) });
</script> </script>
<template> <template>
<input v-model="modelValue" :class="cn('flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', props.class)"> <input
v-model="modelValue"
:class="
cn(
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
props.class,
)
"
/>
</template> </template>

View file

@ -1 +1 @@
export { default as Input } from './Input.vue' export { default as Input } from "./Input.vue";

View file

@ -61,6 +61,6 @@
"chatbot": "Chatbot", "chatbot": "Chatbot",
"starred": "Starred", "starred": "Starred",
"terminal": "Terminal", "terminal": "Terminal",
"aboutNewsOrg": "About this news organization", "aboutNewsOrg": "About this news organization"
} }
} }

View file

@ -157,7 +157,7 @@ const associAppWindow = [
id: "11", id: "11",
title: t("app.terminal"), title: t("app.terminal"),
component: Error404Window, component: Error404Window,
} },
]; ];
/* /*
@ -304,14 +304,14 @@ const findAndOpenWindow = (windowName: string) => {
const obtainTopWindowPosition = (windowId: string) => { const obtainTopWindowPosition = (windowId: string) => {
if (!openingAppViaAnApp.value) { if (!openingAppViaAnApp.value) {
const windowIndex = activeWindows.value.findIndex( const windowIndex = activeWindows.value.findIndex(
(window) => window.id === windowId, (window) => window.id === windowId,
); );
if (windowIndex !== -1) { if (windowIndex !== -1) {
const [window] = activeWindows.value.splice(windowIndex, 1); const [window] = activeWindows.value.splice(windowIndex, 1);
titleAppName.value = window.name; titleAppName.value = window.name;
activeWindows.value.push(window); activeWindows.value.push(window);
}
} }
}
}; };
const closeWindow = (windowId: string) => { const closeWindow = (windowId: string) => {
@ -326,8 +326,8 @@ const openNewWindowViaApp = (windowId: string) => {
findAndOpenWindow(windowId); findAndOpenWindow(windowId);
setTimeout(() => { setTimeout(() => {
openingAppViaAnApp.value = false; openingAppViaAnApp.value = false;
},1000); }, 1000);
} };
const maxWindow = (windowId: string) => {}; const maxWindow = (windowId: string) => {};

0
prettier.config.js Normal file
View file