改进 记忆显示
This commit is contained in:
parent
57f36f0b64
commit
2134f4c7be
@ -2011,7 +2011,9 @@ paths:
|
|||||||
- $ref: '#/definitions/schema.ResponseBody'
|
- $ref: '#/definitions/schema.ResponseBody'
|
||||||
- properties:
|
- properties:
|
||||||
data:
|
data:
|
||||||
$ref: '#/definitions/entity.Memory'
|
items:
|
||||||
|
$ref: '#/definitions/entity.Memory'
|
||||||
|
type: array
|
||||||
type: object
|
type: object
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
|
@ -515,10 +515,10 @@ export interface ApiV1LibrariesPost201Response {
|
|||||||
export interface ApiV1MemoriesGet200Response {
|
export interface ApiV1MemoriesGet200Response {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {EntityMemory}
|
* @type {Array<EntityMemory>}
|
||||||
* @memberof ApiV1MemoriesGet200Response
|
* @memberof ApiV1MemoriesGet200Response
|
||||||
*/
|
*/
|
||||||
'data'?: EntityMemory;
|
'data'?: Array<EntityMemory>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -1,15 +1,73 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="text-center">
|
<div class="text-center" v-if="!memories.length">
|
||||||
<n-icon class="text-7xl">
|
<n-icon class="text-7xl">
|
||||||
<GiftSharp />
|
<GiftSharp />
|
||||||
</n-icon>
|
</n-icon>
|
||||||
<p>Amber 会根据您的对话更加了解你</p>
|
<n-p>Amber 会根据您的对话更加了解你</n-p>
|
||||||
<div class="mt-3 mb-2">
|
<!-- <div class="mt-3 mb-2">
|
||||||
<n-button>创建</n-button>
|
<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>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { EntityMemory } from "@/api";
|
||||||
|
import getApi from "@/plugins/api";
|
||||||
import { GiftSharp } from "@vicons/ionicons5";
|
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>
|
</script>
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
ChatPublicApi,
|
ChatPublicApi,
|
||||||
Configuration,
|
Configuration,
|
||||||
LibrariesApi,
|
LibrariesApi,
|
||||||
|
MemoiresApi,
|
||||||
PingApi,
|
PingApi,
|
||||||
ToolApi,
|
ToolApi,
|
||||||
} from "../api";
|
} from "../api";
|
||||||
@ -22,6 +23,7 @@ interface Api {
|
|||||||
ChatMessage: ChatMessageApi;
|
ChatMessage: ChatMessageApi;
|
||||||
ChatPublic: ChatPublicApi;
|
ChatPublic: ChatPublicApi;
|
||||||
Library: LibrariesApi;
|
Library: LibrariesApi;
|
||||||
|
Memory: MemoiresApi;
|
||||||
conf: Configuration
|
conf: Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +55,7 @@ const getApi = () => {
|
|||||||
ChatMessage: new ChatMessageApi(conf, undefined, axios),
|
ChatMessage: new ChatMessageApi(conf, undefined, axios),
|
||||||
ChatPublic: new ChatPublicApi(conf, undefined, axios),
|
ChatPublic: new ChatPublicApi(conf, undefined, axios),
|
||||||
Library: new LibrariesApi(conf, undefined, axios),
|
Library: new LibrariesApi(conf, undefined, axios),
|
||||||
|
Memory: new MemoiresApi(conf, undefined, axios),
|
||||||
conf: conf
|
conf: conf
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user