판정 룰(앵커타결/와일드존/3라운드결렬)과 카드 선택을 학습 정책으로 대체: 수락/역제안 금액/압박 화법/결렬 전부 행동 30개(수락1+결렬1+역제안 6단x화법4+압박4)에서 선택. - autonomy_actions: 행동 공간·특징 인코딩 (학습/서빙 공유) - autonomy_store: numpy 서빙 + 행동 봉투 7개(수락<=목표가 / 역제안 단조 / 역제시·결렬은 설득 2회 후 해금 / 마무리국면 압박 금지 / 첫 역제안 앵커 이하 / 최종제안 1회 보장) - chat_engine: 자율 스텝(역제안/최종제안/압박1~4), 최종제안 금액=목표가, 턴캡 12 - ment_generator: Gemini 멘트 생성 + 가드(숫자 화이트리스트·목표가 비공개·금지어·문장완결, 실패시 템플릿 폴백, 6초 컷), 인터넷최저가 근거 인용(수집됨+제시가 초과시만), 대화 기억 - chat_service: 자율 행동 experience_logs 로깅(AUT|종류|위치|전략), 대화기억 ctx 관리 - context loader/CRUD: 인터넷최저가·견적기간·협력사 이력 로드 (v3 상태 21차원) - train_full_autonomy: 시뮬 15k ep — 앵커율 0.8~6% 정합, 협력사 현실화(컷반발·반복짜증· 양보 상호성), 관측성 마스크(마감 40% 미관측·15% 전부미상 — 서빙 중립값 분포 정합), 보상 수정(목표가 초과 타결=결렬 취급) - 서빙 v3.5 (v3.3 목표가 즉시지르기 퇴화, v3.4 소액지형 첫턴 통보 퇴화 — 게이트 반려 이력 보관) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
117 lines
4.8 KiB
YAML
117 lines
4.8 KiB
YAML
# Negosium + Negodata 백엔드.
|
|
# DB 는 compose 에서 관리하지 않는다 — 각 backend 는 config.docker.toml 의 접속 정보대로
|
|
# 외부 PostgreSQL 에 연결한다(호스트에 떠 있는 로컬 postgres, 또는 따로 실행 중인 docker postgres).
|
|
# 컨테이너에서 호스트의 DB 에 접속할 때는 host.docker.internal 을 쓴다.
|
|
#
|
|
# docker compose up -d
|
|
# negosium 서버: http://localhost:9300/docs
|
|
# negosium 프론트: http://localhost:3300
|
|
# negodata 서버: http://localhost:9400/docs
|
|
# agent 서버: http://localhost:9500/docs
|
|
# anchoring 배치: 포트 없음 — 상주 스케줄러(격주 토 00:00 KST), docker logs anchoring 으로 확인
|
|
#
|
|
# DB 준비(최초 1회): postgres-init 의 SQL 을 대상 DB 에 적용한다.
|
|
# psql -h <host> -p <port> -U <user> -f postgres-init/00-init.sql (스키마 전체: negosium_db + 도메인·learning·anchoring schema)
|
|
# psql -h <host> -p <port> -U <user> -f postgres-init/temp-data.sql (임시 데이터 시드: admin / admin1234, company.users)
|
|
|
|
services:
|
|
negosium-backend:
|
|
build: ./backend
|
|
container_name: negosium-backend
|
|
environment:
|
|
APP_ENV: local
|
|
DB_HOST: host.docker.internal # 컨테이너→호스트 DB (config.local.toml의 127.0.0.1 override)
|
|
AGENT_BASE_URL: http://host.docker.internal:9500 # 컨테이너→호스트 agent (로컬 uvicorn :9500)
|
|
ports:
|
|
- "9300:9300"
|
|
# 컨테이너에서 호스트의 DB 로 접근 (config.docker.toml 의 host.docker.internal)
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
restart: unless-stopped
|
|
|
|
negodata-backend:
|
|
build: ./negodata/backend
|
|
container_name: negodata-backend
|
|
environment:
|
|
APP_ENV: local
|
|
DB_HOST: host.docker.internal # 컨테이너→호스트 DB (config.local.toml의 127.0.0.1 override)
|
|
RELOAD: "1" # uvicorn --reload 활성 → 소스 저장 시 자동 재기동(재빌드 불필요)
|
|
SCHEDULER_ENABLED: "1" # 마감 크론 활성(단일 워커라 중복 없음). 운영 다중 워커면 1개 프로세스에서만 1
|
|
PYTHONUNBUFFERED: "1" # 컨테이너 로그 실시간 출력(stdout 버퍼링 끔)
|
|
volumes:
|
|
- ./negodata/backend:/app # 호스트 소스 = 컨테이너 코드. 이게 있어야 수정이 즉시 반영됨
|
|
ports:
|
|
- "9400:9400"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
restart: unless-stopped
|
|
|
|
# negodata 프론트 (Vite dev 서버).
|
|
negodata-front:
|
|
build: ./negodata/front
|
|
container_name: negodata-front
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- ./negodata/front:/app
|
|
- /app/node_modules
|
|
restart: unless-stopped
|
|
|
|
# 협상 에이전트 (negosium_db 공유, learning 스키마 사용).
|
|
agent:
|
|
build: ./agent
|
|
container_name: negosium-agent
|
|
environment:
|
|
APP_ENV: local
|
|
DB_HOST: host.docker.internal # 컨테이너→호스트 DB (config.local.toml의 127.0.0.1 override)
|
|
DQN_SERVING: "1" # 카드 선택을 feature_dqn(numpy 서빙)으로. 0 이면 기존 UCB Q-table
|
|
AUTONOMY_MODE: "1" # 완전 자율 협상(판정 룰·카드 제거, 정책이 수락/역제안/결렬 결정). 0 이면 룰 엔진
|
|
ports:
|
|
- "9500:9500"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
restart: unless-stopped
|
|
|
|
# negosium 공급사 프론트 (프로덕션 빌드 정적 서빙, :3300). 브라우저가 backend(:9300)를 직접 호출.
|
|
negosium-front:
|
|
build: ./frontend
|
|
container_name: negosium-front
|
|
ports:
|
|
- "3300:3300"
|
|
restart: unless-stopped
|
|
|
|
# 앵커링 값 자동 조정 배치 (negosium_db 공유, 포트 없음 — 상주 스케줄러).
|
|
anchoring:
|
|
build: ./schedules/anchoring
|
|
container_name: anchoring
|
|
environment:
|
|
APP_ENV: local # config.{APP_ENV}.toml 선택 (local/dev/prod)
|
|
DB_HOST: host.docker.internal # 컨테이너→호스트 DB
|
|
REDIS_HOST: anchoring-redis
|
|
TZ: Asia/Seoul
|
|
volumes:
|
|
- ./schedules/anchoring/config.local.toml:/app/config.local.toml:ro # 시크릿은 마운트 — up 전에 파일 필요
|
|
depends_on:
|
|
- anchoring-redis
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
restart: unless-stopped
|
|
logging: # 상주 배치 — 장기 운영 디스크 보호
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "5"
|
|
|
|
# 앵커링 조회 캐시 (anchoring 전용)
|
|
anchoring-redis:
|
|
image: redis:7-alpine
|
|
container_name: anchoring-redis
|
|
ports:
|
|
- "127.0.0.1:6380:6379" # 호스트 로컬만 개방 (무인증 Redis). 6380 = 호스트 redis(6379)와 충돌 회피
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "5"
|