likes
This commit is contained in:
@@ -52,9 +52,10 @@ export const aiService = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Get generations history
|
// Get generations history
|
||||||
async getGenerations(limit, offset, characterId) {
|
async getGenerations(limit, offset, characterId, onlyLiked = false) {
|
||||||
const params = { limit, offset }
|
const params = { limit, offset }
|
||||||
if (characterId) params.character_id = characterId
|
if (characterId) params.character_id = characterId
|
||||||
|
if (onlyLiked) params.only_liked = true
|
||||||
const response = await api.get('/generations', { params })
|
const response = await api.get('/generations', { params })
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,5 +8,9 @@ export const ideaService = {
|
|||||||
deleteIdea: (id) => api.delete(`/ideas/${id}`),
|
deleteIdea: (id) => api.delete(`/ideas/${id}`),
|
||||||
addGenerationToIdea: (ideaId, generationId) => api.post(`/ideas/${ideaId}/generations/${generationId}`),
|
addGenerationToIdea: (ideaId, generationId) => api.post(`/ideas/${ideaId}/generations/${generationId}`),
|
||||||
removeGenerationFromIdea: (ideaId, generationId) => api.delete(`/ideas/${ideaId}/generations/${generationId}`),
|
removeGenerationFromIdea: (ideaId, generationId) => api.delete(`/ideas/${ideaId}/generations/${generationId}`),
|
||||||
getIdeaGenerations: (ideaId, limit = 10, offset = 0) => api.get(`/ideas/${ideaId}/generations`, { params: { limit, offset } })
|
getIdeaGenerations: (ideaId, limit = 10, offset = 0, onlyLiked = false) => {
|
||||||
|
const params = { limit, offset };
|
||||||
|
if (onlyLiked) params.only_liked = true;
|
||||||
|
return api.get(`/ideas/${ideaId}/generations`, { params });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -133,9 +133,9 @@ export const useIdeaStore = defineStore('ideas', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assuming getIdeaGenerations is separate from getIdea
|
// Assuming getIdeaGenerations is separate from getIdea
|
||||||
async function fetchIdeaGenerations(ideaId, limit = 100, offset = 0) {
|
async function fetchIdeaGenerations(ideaId, limit = 100, offset = 0, onlyLiked = false) {
|
||||||
try {
|
try {
|
||||||
const response = await ideaService.getIdeaGenerations(ideaId, limit, offset);
|
const response = await ideaService.getIdeaGenerations(ideaId, limit, offset, onlyLiked);
|
||||||
return response;
|
return response;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching idea generations:', err);
|
console.error('Error fetching idea generations:', err);
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ watch(isSettingsVisible, (val) => {
|
|||||||
|
|
||||||
const activeOverlayId = ref(null) // For mobile tap-to-show overlay
|
const activeOverlayId = ref(null) // For mobile tap-to-show overlay
|
||||||
const filterCharacter = ref(null) // Character filter for gallery
|
const filterCharacter = ref(null) // Character filter for gallery
|
||||||
|
const onlyLiked = ref(false)
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
const qualityOptions = ref([
|
const qualityOptions = ref([
|
||||||
@@ -287,6 +288,13 @@ watch(filterCharacter, async () => {
|
|||||||
await refreshHistory()
|
await refreshHistory()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(onlyLiked, async () => {
|
||||||
|
historyGenerations.value = []
|
||||||
|
historyTotal.value = 0
|
||||||
|
historyFirst.value = 0
|
||||||
|
await refreshHistory()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// --- Data Loading ---
|
// --- Data Loading ---
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
@@ -364,7 +372,7 @@ const loadData = async () => {
|
|||||||
|
|
||||||
const refreshHistory = async () => {
|
const refreshHistory = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await aiService.getGenerations(historyRows.value, 0, filterCharacter.value?.id || filterCharacter.value?._id)
|
const response = await aiService.getGenerations(historyRows.value, 0, filterCharacter.value?.id || filterCharacter.value?._id, onlyLiked.value)
|
||||||
if (response && response.generations) {
|
if (response && response.generations) {
|
||||||
// Update existing items and add new ones at the top
|
// Update existing items and add new ones at the top
|
||||||
const newGenerations = []
|
const newGenerations = []
|
||||||
@@ -525,7 +533,7 @@ const loadMoreHistory = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const nextOffset = historyGenerations.value.length
|
const nextOffset = historyGenerations.value.length
|
||||||
const response = await aiService.getGenerations(historyRows.value, nextOffset, filterCharacter.value?.id)
|
const response = await aiService.getGenerations(historyRows.value, nextOffset, filterCharacter.value?.id, onlyLiked.value)
|
||||||
|
|
||||||
if (response && response.generations) {
|
if (response && response.generations) {
|
||||||
const newGenerations = response.generations.filter(gen =>
|
const newGenerations = response.generations.filter(gen =>
|
||||||
@@ -880,6 +888,11 @@ const confirmAddToAlbum = async () => {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
<Button :icon="onlyLiked ? 'pi pi-heart-fill' : 'pi pi-heart'"
|
||||||
|
@click="onlyLiked = !onlyLiked" rounded text
|
||||||
|
class="!w-7 !h-7 !p-0"
|
||||||
|
:class="onlyLiked ? '!text-pink-500 !bg-pink-500/10' : '!text-slate-400 hover:!bg-white/10'"
|
||||||
|
v-tooltip.bottom="onlyLiked ? 'Show all' : 'Show liked only'" />
|
||||||
<Button icon="pi pi-refresh" @click="refreshHistory" rounded text
|
<Button icon="pi pi-refresh" @click="refreshHistory" rounded text
|
||||||
class="!text-slate-400 hover:!bg-white/10 !w-7 !h-7 !p-0 md:hidden" />
|
class="!text-slate-400 hover:!bg-white/10 !w-7 !h-7 !p-0 md:hidden" />
|
||||||
<Button :icon="isSelectMode ? 'pi pi-times' : 'pi pi-check-square'" @click="toggleSelectMode"
|
<Button :icon="isSelectMode ? 'pi pi-times' : 'pi pi-check-square'" @click="toggleSelectMode"
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ restoreSettings()
|
|||||||
watch([prompt, quality, aspectRatio, imageCount, selectedModel, sendToTelegram, telegramId, useProfileImage, useEnvironment, selectedCharacter, selectedEnvironment, selectedAssets], saveSettings, { deep: true })
|
watch([prompt, quality, aspectRatio, imageCount, selectedModel, sendToTelegram, telegramId, useProfileImage, useEnvironment, selectedCharacter, selectedEnvironment, selectedAssets], saveSettings, { deep: true })
|
||||||
|
|
||||||
const viewMode = ref('feed') // 'feed' or 'gallery'
|
const viewMode = ref('feed') // 'feed' or 'gallery'
|
||||||
|
const onlyLiked = ref(false)
|
||||||
const isSubmitting = ref(false)
|
const isSubmitting = ref(false)
|
||||||
const isSettingsVisible = ref(localStorage.getItem('idea_detail_settings_visible') !== 'false')
|
const isSettingsVisible = ref(localStorage.getItem('idea_detail_settings_visible') !== 'false')
|
||||||
|
|
||||||
@@ -255,7 +256,7 @@ const loadCharacters = async () => {
|
|||||||
const fetchGenerations = async (ideaId) => {
|
const fetchGenerations = async (ideaId) => {
|
||||||
loadingGenerations.value = true
|
loadingGenerations.value = true
|
||||||
try {
|
try {
|
||||||
const response = await ideaStore.fetchIdeaGenerations(ideaId, 100)
|
const response = await ideaStore.fetchIdeaGenerations(ideaId, 100, onlyLiked.value)
|
||||||
let loadedGens = []
|
let loadedGens = []
|
||||||
if (response.data && response.data.generations) {
|
if (response.data && response.data.generations) {
|
||||||
loadedGens = response.data.generations
|
loadedGens = response.data.generations
|
||||||
@@ -914,6 +915,12 @@ const toggleLike = async (gen) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(onlyLiked, (newVal) => {
|
||||||
|
if (currentIdea.value) {
|
||||||
|
fetchGenerations(currentIdea.value.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Exit select mode when switching to feed
|
// Exit select mode when switching to feed
|
||||||
watch(viewMode, (v) => {
|
watch(viewMode, (v) => {
|
||||||
if (v !== 'gallery') {
|
if (v !== 'gallery') {
|
||||||
@@ -969,6 +976,12 @@ watch(viewMode, (v) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Button :icon="onlyLiked ? 'pi pi-heart-fill' : 'pi pi-heart'"
|
||||||
|
@click="onlyLiked = !onlyLiked" rounded text
|
||||||
|
class="!w-7 !h-7 !p-0"
|
||||||
|
:class="onlyLiked ? '!text-pink-500 !bg-pink-500/10' : '!text-slate-400 hover:!bg-white/10'"
|
||||||
|
v-tooltip.bottom="onlyLiked ? 'Show all' : 'Show liked only'" />
|
||||||
|
|
||||||
<Button icon="pi pi-trash" text rounded severity="danger" size="small"
|
<Button icon="pi pi-trash" text rounded severity="danger" size="small"
|
||||||
class="!w-7 !h-7"
|
class="!w-7 !h-7"
|
||||||
v-tooltip.bottom="'Delete Idea'"
|
v-tooltip.bottom="'Delete Idea'"
|
||||||
|
|||||||
Reference in New Issue
Block a user