AIDeveloper-PC/ai_test_generator/config.py

22 lines
754 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from dataclasses import dataclass
@dataclass
class Config:
# LLM配置以OpenAI兼容接口为例可替换为其他LLM
LLM_API_KEY: str = os.getenv("LLM_API_KEY", "your-api-key-here")
LLM_BASE_URL: str = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")
LLM_MODEL: str = os.getenv("LLM_MODEL", "gpt-4o")
LLM_TEMPERATURE: float = 0.2
LLM_MAX_TOKENS: int = 4096
# 测试配置
GENERATED_TESTS_DIR: str = "generated_tests"
TEST_TIMEOUT: int = 30 # 单个测试超时时间(秒)
# HTTP测试配置
HTTP_BASE_URL: str = os.getenv("HTTP_BASE_URL", "http://localhost:8080")
HTTP_TIMEOUT: int = 10
UNIT_KEYWORDS: tuple = ("units", "functions", "apis")
config = Config()