feat;配置文件整改-提取
This commit is contained in:
9
.env
9
.env
@@ -1,3 +1,10 @@
|
||||
#api key
|
||||
MODEL_API_KEY=sk-9nng4v6qsdiw42r6d3re4nym15hiti29
|
||||
#模型地址
|
||||
MODEL_BASE_URL=https://gateout.yced.com.cn/v1
|
||||
MODEL_NAME=deepseek
|
||||
#模型名称
|
||||
MODEL_NAME=deepseek
|
||||
#放行host地址
|
||||
DJANGO_ALLOWED_HOSTS=192.168.237.130,127.0.0.1,10.212.27.4
|
||||
#是否开启debug模式
|
||||
DJANGO_DEBUG_ENABLE=False
|
||||
@@ -7,7 +7,9 @@ import uuid
|
||||
import logging
|
||||
from typing import Dict, Optional, Any
|
||||
from decouple import config
|
||||
import urllib3
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
# API endpoint as a configurable variable
|
||||
DEFAULT_API_ENDPOINT = config('MODEL_BASE_URL', default="https://www.chataiapi.com/v1")
|
||||
retry = Retry(total=5, backoff_factor=1)
|
||||
@@ -75,7 +77,7 @@ def call_openai_api(
|
||||
if user_query and len(user_query) > 0:
|
||||
messages.append({"role": "user", "content": user_query})
|
||||
if assistant_query and len(assistant_query) > 0:
|
||||
messages.append({"role": "assistant", "content": assistant_query})
|
||||
messages.append({"role": "assistant", "content": assistant_query})
|
||||
else:
|
||||
|
||||
messages = [
|
||||
|
||||
@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from decouple import config
|
||||
from decouple import config, Csv
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@@ -23,9 +23,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'django-insecure-i(fm5c2v*=vgfwmgdl^qi7iezv(xfwovbqu=+^=vm72e$gnx&l'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = config('DJANGO_DEBUG_ENABLE', cast=bool, default=True)
|
||||
|
||||
ALLOWED_HOSTS = ["192.168.237.130", '127.0.0.1','10.212.27.4']
|
||||
ALLOWED_HOSTS = [i for i in config('DJANGO_ALLOWED_HOSTS', cast=str).split(',')]
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -43,7 +43,7 @@ MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
#'django.middleware.csrf.CsrfViewMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
@@ -101,7 +101,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user