Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rvbear authored Aug 2, 2024
2 parents 5518754 + 718ac91 commit fd00d5e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion config/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Meta:
hashcode = [0]


def to_camel_case(word):
components = word.split('_')
return components[0] + ''.join(x.title() for x in components[1:])

class ApiResponse(serializers.Serializer):
isSuccess = serializers.BooleanField()
message = serializers.CharField(max_length=100)
Expand All @@ -44,9 +48,17 @@ def get_dynamic_class(result_class, many=False):

hashcode[0] += 1

camel_case_fields = {}
for field_name, field_instance in result_class().get_fields().items():
camel_case_name = to_camel_case(field_name)
camel_case_fields[camel_case_name] = field_instance

camel_case_serializer = type(result_class.__name__ + 'CamelCase' + str(hashcode[0]), (serializers.Serializer,),
camel_case_fields)

d_class = type(class_name, (ApiResponse,), {
'Meta': meta_class,
'result': result_class(many=many)
'result': camel_case_serializer(many=many)
})

return d_class
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- .env-django
- .env-s3
- .env-deepl
command: gunicorn config.wsgi:application --bind 0.0.0.0:8000
command: gunicorn config.wsgi:application --bind 0.0.0.0:8000 --log-level debug

neo4j:
ports:
Expand Down
1 change: 1 addition & 0 deletions image/gpt/GenerateImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def gpt_generate_image_urls(english_prompt: str, model="dall-e-2", n=1, size="25
}

response = requests.post(request_url, json=data, headers=headers)
print(response)

return [i['url'] for i in response.json()['data']]

Expand Down

0 comments on commit fd00d5e

Please sign in to comment.