forked from Leaf/amber-ui
改进 记忆显示
This commit is contained in:
parent
57f36f0b64
commit
2134f4c7be
@ -2011,7 +2011,9 @@ paths:
|
||||
- $ref: '#/definitions/schema.ResponseBody'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/entity.Memory'
|
||||
type: array
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
|
@ -515,10 +515,10 @@ export interface ApiV1LibrariesPost201Response {
|
||||
export interface ApiV1MemoriesGet200Response {
|
||||
/**
|
||||
*
|
||||
* @type {EntityMemory}
|
||||
* @type {Array<EntityMemory>}
|
||||
* @memberof ApiV1MemoriesGet200Response
|
||||
*/
|
||||
'data'?: EntityMemory;
|
||||
'data'?: Array<EntityMemory>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
|
@ -1,15 +1,73 @@
|
||||
<template>
|
||||
<div class="text-center">
|
||||
<div class="text-center" v-if="!memories.length">
|
||||
<n-icon class="text-7xl">
|
||||
<GiftSharp />
|
||||
</n-icon>
|
||||
<p>Amber 会根据您的对话更加了解你</p>
|
||||
<div class="mt-3 mb-2">
|
||||
<n-p>Amber 会根据您的对话更加了解你</n-p>
|
||||
<!-- <div class="mt-3 mb-2">
|
||||
<n-button>创建</n-button>
|
||||
</div> -->
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="mb-3">
|
||||
<n-popconfirm @positive-click="purgeMemory">
|
||||
<template #trigger>
|
||||
<n-button tertiary> 清除记忆 </n-button>
|
||||
</template>
|
||||
清除后, 助理将不会记得你的喜好
|
||||
</n-popconfirm>
|
||||
</div>
|
||||
<n-list hoverable clickable>
|
||||
<n-list-item v-for="c in memories" :key="c.id">
|
||||
<n-thing>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>
|
||||
{{ c.content }}
|
||||
</div>
|
||||
<div>
|
||||
<n-popconfirm @positive-click="deleteMemory(c)">
|
||||
<template #trigger>
|
||||
<n-button quaternary circle type="info">
|
||||
<template #icon>
|
||||
<n-icon size="16" class="cursor-pointer">
|
||||
<TrashBinOutline />
|
||||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
</template>
|
||||
删除后, 助理将不再记得这条记忆
|
||||
</n-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
</n-thing>
|
||||
</n-list-item>
|
||||
</n-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { EntityMemory } from "@/api";
|
||||
import getApi from "@/plugins/api";
|
||||
import { GiftSharp } from "@vicons/ionicons5";
|
||||
import { TrashBinOutline } from "@vicons/ionicons5";
|
||||
|
||||
const memories: Ref<EntityMemory[]> = ref([]);
|
||||
|
||||
const getMemories = async () => {
|
||||
memories.value = (await getApi().Memory.apiV1MemoriesGet()).data.data ?? [];
|
||||
};
|
||||
|
||||
const deleteMemory = async (memory: EntityMemory) => {
|
||||
await getApi().Memory.apiV1MemoriesIdDelete(memory.id ?? 0);
|
||||
getMemories();
|
||||
};
|
||||
|
||||
const purgeMemory = async () => {
|
||||
await getApi().Memory.apiV1MemoriesPurgePost();
|
||||
getMemories();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getMemories();
|
||||
});
|
||||
</script>
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
ChatPublicApi,
|
||||
Configuration,
|
||||
LibrariesApi,
|
||||
MemoiresApi,
|
||||
PingApi,
|
||||
ToolApi,
|
||||
} from "../api";
|
||||
@ -22,6 +23,7 @@ interface Api {
|
||||
ChatMessage: ChatMessageApi;
|
||||
ChatPublic: ChatPublicApi;
|
||||
Library: LibrariesApi;
|
||||
Memory: MemoiresApi;
|
||||
conf: Configuration
|
||||
}
|
||||
|
||||
@ -53,6 +55,7 @@ const getApi = () => {
|
||||
ChatMessage: new ChatMessageApi(conf, undefined, axios),
|
||||
ChatPublic: new ChatPublicApi(conf, undefined, axios),
|
||||
Library: new LibrariesApi(conf, undefined, axios),
|
||||
Memory: new MemoiresApi(conf, undefined, axios),
|
||||
conf: conf
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user