remove dollor model cuclation and fix price filter bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.db import models
|
||||
from account.models import User
|
||||
from product.models import ProductModel, DollorModel
|
||||
from product.models import ProductModel
|
||||
from django.conf import settings
|
||||
import openai
|
||||
from time import sleep
|
||||
@@ -24,9 +24,7 @@ class ProductChatModel(models.Model):
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.thread:
|
||||
client = openai.OpenAI(api_key=settings.OPENAI_API_KEY)
|
||||
dollor_object, _ = DollorModel.objects.get_or_create(unique_filed='unique')
|
||||
dollor_price = dollor_object.price
|
||||
product_json = DynamicProductSerializer(instance=self.product, context={'dollor_price': dollor_price, 'view_type': 'chat'}).data
|
||||
product_json = DynamicProductSerializer(instance=self.product, context={'view_type': 'chat'}).data
|
||||
try:
|
||||
|
||||
thread = client.beta.threads.create(
|
||||
|
||||
Reference in New Issue
Block a user