Skip to content

Commit

Permalink
Merge pull request #1758 from slntopp/dev
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
639852 committed Jun 4, 2024
2 parents 70f2aa2 + bd7cef3 commit 2621962
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions admin-ui/src/components/plan/openaiPrices.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<nocloud-table
table-name="openai-prices_table"
:headers="headers"
:items="resources"
:items="items"
:show-select="false"
>
<template v-slot:[`item.price`]="{ item }">
Expand All @@ -17,7 +17,7 @@
</template>

<script setup>
import { onMounted, ref, toRefs } from "vue";
import { computed, onMounted, ref, toRefs } from "vue";
import NocloudTable from "@/components/table.vue";
import api from "@/api";
import { useStore } from "@/store";
Expand Down Expand Up @@ -45,38 +45,60 @@ const resources = ref([
public: true,
},
{
key: "image_size_1024_1024_quality_standart",
key: "image_size_1024x1024_quality_standard",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1024",
public: true,
},
{
key: "image_size_1024_1024_quality_hd",
key: "image_size_1024x1024_quality_hd",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1024 HD",
public: true,
},
{
key: "image_size_1024_1792_quality_standart",
key: "image_size_1024x1792_quality_standard",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1792 or 1792*1024",
public: true,
},
{
key: "image_size_1024_1792_quality_hd",
key: "image_size_1024x1792_quality_hd",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1792 or 1792*1024 HD",
public: true,
},
{
key: "image_size_1792x1024_quality_standard",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1792 or 1792*1024",
public: true,
},
{
key: "image_size_1792x1024_quality_hd",
kind: "POSTPAID",
price: 0,
period: 0,
title: "Image 1024*1792 or 1792*1024 HD",
public: true,
}
]);
const items = computed(() =>
resources.value.filter(({ key }) =>
!['image_size_1792x1024_quality_standard', 'image_size_1792x1024_quality_hd'].includes(key)
)
)
const headers = [
{ text: "Key", value: "key" },
{ text: "Title", value: "title" },
Expand All @@ -103,10 +125,28 @@ onMounted(() => {
const save = async () => {
isSaveLoading.value = true;
try {
const result = JSON.parse(JSON.stringify(resources.value))
const imageSize1792x1024 = result.find(({ key }) =>
key.includes('image_size_1792x1024_quality_standard')
)
const imageSize1792x1024HD = result.find(({ key }) =>
key.includes('image_size_1792x1024_quality_hd')
)
const imageSize1024x1792 = result.find(({ key }) =>
key.includes('image_size_1024x1792_quality_standard')
)
const imageSize1024x1792HD = result.find(({ key }) =>
key.includes('image_size_1024x1792_quality_hd')
)
imageSize1792x1024.price = imageSize1024x1792.price
imageSize1792x1024HD.price = imageSize1024x1792HD.price
await api.plans.update(props.template.uuid, {
...props.template,
products: {},
resources: JSON.parse(JSON.stringify(resources.value)),
resources: result,
});
store.commit("snackbar/showSnackbarSuccess", {
Expand Down

0 comments on commit 2621962

Please sign in to comment.