cryogenic22/Stock_Agent_optimized
0
1# config/settings.py2 3import os4from pathlib import Path5import streamlit as st6 7# Check if we're running on HuggingFace Space8IS_HF_SPACE = os.getenv('SPACE_ID') is not None9 10# Base directories11if IS_HF_SPACE:12 # Use a directory in the HF space13 BASE_DIR = Path('/data')14else:15 BASE_DIR = Path(__file__).resolve().parent.parent16 17# Data directories18DATA_DIR = BASE_DIR / "data"19CHAT_HISTORIES_DIR = DATA_DIR / "chat_histories"20CHAT_IMAGES_DIR = DATA_DIR / "chat_images"21 22# Create directories if they don't exist23for directory in [DATA_DIR, CHAT_HISTORIES_DIR, CHAT_IMAGES_DIR]:24 try:25 directory.mkdir(parents=True, exist_ok=True)26 # Ensure directories are writable27 if directory.exists():28 os.chmod(directory, 0o777)29 except Exception as e:30 st.warning(f"Could not create or modify directory {directory}: {str(e)}")31 # Fallback to temporary directory if needed32 if str(directory).startswith(str(BASE_DIR)):33 new_path = Path('/tmp') / directory.relative_to(BASE_DIR)34 new_path.mkdir(parents=True, exist_ok=True)35 if IS_HF_SPACE:36 directory = new_path37 38# API Settings - Get from HuggingFace secrets39ANTHROPIC_API_KEY = os.getenv('ANTHROPIC_API_KEY')40CLAUDE_MODEL = "claude-3-opus-20240229"41 42# App Settings43APP_NAME = "Stock Chart Assistant"44APP_EMOJI = "๐"45 46# Analysis Options47CHART_PATTERNS = [48 "Double Top/Bottom",49 "Head and Shoulders",50 "Triangle",51 "Flag",52 "Wedge",53 "Channel",54 "Support/Resistance"55]56 57TECHNICAL_INDICATORS = [58 "Moving Averages",59 "RSI",60 "MACD",61 "Bollinger Bands",62 "Volume",63 "Stochastic",64 "ADX"65]