가격 트랙 라벨 겹침 수정(스태거 배치) + 포트 변경 frontend 3000 · backend 3300
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UFZ7JWdwCaQAwNYJErL8pP
This commit is contained in:
1 parent
045f2517be
commit
156ce3817d
16 files changed
+71
-36
No files matched your search
@@ -7,8 +7,8 @@
|
||||
| 폴더 | 내용 |
|
||||
|---|---|
|
||||
| `docs/` | 문서 — 실행가이드·서버 아키텍처·협상엔진 산식·평가지표 정리·연구개발계획서 |
|
||||
| `server/` | 협상 엔진 (FastAPI, :53117) — `config.toml.example` 복사 후 키 기입 |
|
||||
| `frontend/` | 데모 콘솔 (React+Vite, :5317) — `npm install && npm run dev` |
|
||||
| `server/` | 협상 엔진 (FastAPI, :3300) — `config.toml.example` 복사 후 키 기입 |
|
||||
| `frontend/` | 데모 콘솔 (React+Vite, :3000) — `npm install && npm run dev` |
|
||||
| `eval/` | 지표 측정 코드 (하네스·집계기) — 산출물은 `results/`에 |
|
||||
| `testdata/` | 테스트셋 생성기 + 재현 가능 테스트셋 (seed 고정) |
|
||||
| `results/` | **측정 결과·증빙 (3계층: 원천 → 지표별 → 요약)** — `results/SUMMARY.md`부터 |
|
||||
@@ -19,11 +19,11 @@
|
||||
# 서버
|
||||
cd server && cp config.toml.example config.toml # OpenAI 키 기입 (profiling 사용 시)
|
||||
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
||||
.venv/bin/python3 web_main.py # http://localhost:53117/docs
|
||||
.venv/bin/python3 web_main.py # http://localhost:3300/docs
|
||||
|
||||
# Docker
|
||||
cd server && docker build -t nego-agent .
|
||||
docker run -d -p 53117:53117 -v $PWD/config.toml:/app/config.toml:ro nego-agent
|
||||
docker run -d -p 3300:3300 -v $PWD/config.toml:/app/config.toml:ro nego-agent
|
||||
```
|
||||
|
||||
측정 재현 명령은 `docs/run_guide.md`와 각 `results/*/provenance.md` 참조.
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
# NEGO 협상 에이전트 — backend(:53117) + 데모 frontend(:5317)
|
||||
# NEGO 협상 에이전트 — backend(:3300) + 데모 frontend(:3000)
|
||||
# 실행: ./run.sh (또는 docker compose up -d --build)
|
||||
services:
|
||||
backend:
|
||||
build: ./server
|
||||
image: nego-backend:latest
|
||||
ports:
|
||||
- "53117:53117"
|
||||
- "3300:3300"
|
||||
volumes:
|
||||
# 실 API 키가 든 config.toml 은 이미지에 굽지 않고 실행 시 마운트한다
|
||||
- ./server/config.toml:/app/config.toml:ro
|
||||
@@ -17,7 +17,7 @@ services:
|
||||
build: ./frontend
|
||||
image: nego-frontend:latest
|
||||
ports:
|
||||
- "5317:80"
|
||||
- "3000:80"
|
||||
depends_on:
|
||||
- backend
|
||||
restart: unless-stopped
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""①③ 협상 성공률 · 평균 가격 협상률 — 독립 실행 평가기.
|
||||
|
||||
NEGO_AGENT 서버(:53117 /v1/nego/chat)를 상대로, 공급사 역할 에이전트가 자동 협상을 수행한다.
|
||||
NEGO_AGENT 서버(:3300 /v1/nego/chat)를 상대로, 공급사 역할 에이전트가 자동 협상을 수행한다.
|
||||
|
||||
구성:
|
||||
../../testdata/testset_*.json 합성 케이스셋 (generate_testset.py 산출)
|
||||
@@ -268,7 +268,7 @@ def negotiate(url: str, case: dict, opponent, profiling: bool = False) -> dict:
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--limit", type=int)
|
||||
ap.add_argument("--url", default="http://127.0.0.1:53117/v1/nego/chat")
|
||||
ap.add_argument("--url", default="http://127.0.0.1:3300/v1/nego/chat")
|
||||
ap.add_argument("--opponent", default="scripted", choices=["scripted", "llm"])
|
||||
ap.add_argument("--testset", default="testset_1000.json",
|
||||
help="testdata/ 안의 케이스셋 파일명")
|
||||
|
||||
@@ -46,7 +46,7 @@ def percentile(vals, p):
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--url", default="http://127.0.0.1:53117/v1/nego/chat")
|
||||
ap.add_argument("--url", default="http://127.0.0.1:3300/v1/nego/chat")
|
||||
ap.add_argument("--n", type=int, default=1000)
|
||||
ap.add_argument("--warmup", type=int, default=50)
|
||||
ap.add_argument("--vus", type=int, default=10, help="동시 사용자 수")
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ server {
|
||||
|
||||
# /api/* → backend (프리픽스 제거: /api/v1/... → /v1/...) — vite dev proxy 와 동일 규칙
|
||||
location /api/ {
|
||||
proxy_pass http://backend:53117/;
|
||||
proxy_pass http://backend:3300/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ export default function App() {
|
||||
}`}
|
||||
aria-hidden
|
||||
/>
|
||||
<span className="text-muted">{alive == null ? '확인 중' : alive ? '엔진 연결됨' : '엔진 응답 없음 (:53117)'}</span>
|
||||
<span className="text-muted">{alive == null ? '확인 중' : alive ? '엔진 연결됨' : '엔진 응답 없음 (:3300)'}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ export function ChatPanel({
|
||||
</ol>
|
||||
{error && (
|
||||
<p className="mt-3 rounded-lg bg-amber-soft px-3 py-2 text-sm text-amber">
|
||||
{error} — 서버(:53117)가 켜져 있는지 확인한 뒤 다시 시도하세요.
|
||||
{error} — 서버(:3300)가 켜져 있는지 확인한 뒤 다시 시도하세요.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -15,10 +15,42 @@ export function PriceTrack({ demoCase, priceTrail }: { demoCase: DemoCase; price
|
||||
const lo = Math.min(anchor, ...(priceTrail.length ? priceTrail : [anchor])) * 0.97
|
||||
const pos = (v: number) => Math.min(Math.max(((v - lo) / (hi - lo)) * 100, 0), 100)
|
||||
|
||||
const Tick = ({ value, label, cls }: { value: number; label: string; cls: string }) => (
|
||||
// 기준선 3종 — 제안가가 범위를 크게 넓히면 서로 몰려 라벨이 겹치므로,
|
||||
// 가까운 라벨(간격 < MIN_GAP%)은 아랫줄로 내려 층을 나눈다.
|
||||
const MIN_GAP = 18
|
||||
const ticks = [
|
||||
{ value: anchor, label: '앵커가', cls: 'bg-blue' },
|
||||
{ value: target, label: '목표가', cls: 'bg-ink/50' },
|
||||
{ value: item_price, label: '기존가', cls: 'bg-muted/60' },
|
||||
].sort((a, b) => a.value - b.value)
|
||||
const rows = ticks.map(() => 0)
|
||||
for (let i = 1; i < ticks.length; i++) {
|
||||
let row = 0
|
||||
for (let j = 0; j < i; j++) {
|
||||
if (pos(ticks[i].value) - pos(ticks[j].value) < MIN_GAP && rows[j] === row) {
|
||||
row += 1
|
||||
j = -1 // 줄을 내렸으니 앞 라벨들과 다시 비교
|
||||
}
|
||||
}
|
||||
rows[i] = row
|
||||
}
|
||||
const maxRow = Math.max(...rows)
|
||||
|
||||
// 가장자리에선 중앙정렬 대신 안쪽으로 붙여 패널 밖 클리핑을 막는다
|
||||
const align = (p: number) =>
|
||||
p <= 6
|
||||
? 'translate-x-0 text-left'
|
||||
: p >= 94
|
||||
? '-translate-x-full text-right'
|
||||
: '-translate-x-1/2 text-center'
|
||||
|
||||
const Tick = ({ value, label, cls, row }: { value: number; label: string; cls: string; row: number }) => (
|
||||
<div className="absolute top-0 h-full" style={{ left: `${pos(value)}%` }}>
|
||||
<div className={`h-full w-px ${cls}`} />
|
||||
<div className="absolute top-full mt-1 -translate-x-1/2 text-center">
|
||||
<div
|
||||
className={`absolute whitespace-nowrap ${align(pos(value))}`}
|
||||
style={{ top: `calc(100% + ${4 + row * 28}px)` }}
|
||||
>
|
||||
<div className="text-[10px] leading-tight text-muted">{label}</div>
|
||||
<div className="font-mono text-[11px] font-medium leading-tight">{value.toLocaleString()}</div>
|
||||
</div>
|
||||
@@ -27,7 +59,10 @@ export function PriceTrack({ demoCase, priceTrail }: { demoCase: DemoCase; price
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="relative mb-9 mt-6 h-3 rounded-full bg-paper">
|
||||
<div
|
||||
className="relative mt-6 h-3 rounded-full bg-paper"
|
||||
style={{ marginBottom: `${2.25 + maxRow * 1.75}rem` }}
|
||||
>
|
||||
{/* 구간 채색: [lo~anchor]=파랑(최적) · [anchor~target]=연파랑(합의권) · [target~hi]=앰버(초과) */}
|
||||
<div className="absolute inset-y-0 left-0 rounded-l-full bg-blue/70" style={{ width: `${pos(anchor)}%` }} />
|
||||
<div
|
||||
@@ -38,9 +73,9 @@ export function PriceTrack({ demoCase, priceTrail }: { demoCase: DemoCase; price
|
||||
className="absolute inset-y-0 rounded-r-full bg-amber-soft"
|
||||
style={{ left: `${pos(target)}%`, width: `${100 - pos(target)}%` }}
|
||||
/>
|
||||
<Tick value={anchor} label="앵커가" cls="bg-blue" />
|
||||
<Tick value={target} label="목표가" cls="bg-ink/50" />
|
||||
<Tick value={item_price} label="기존가" cls="bg-muted/60" />
|
||||
{ticks.map((t, i) => (
|
||||
<Tick key={t.label} value={t.value} label={t.label} cls={t.cls} row={rows[i]} />
|
||||
))}
|
||||
|
||||
{/* 과거 제안 흔적 */}
|
||||
{priceTrail.slice(0, -1).map((p, i) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// NEGO_AGENT 서버 API — /api → :53117 (vite proxy)
|
||||
// NEGO_AGENT 서버 API — /api → :3300 (vite proxy)
|
||||
|
||||
import type { CardData, DemoCase } from '../content/cases'
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import tailwindcss from '@tailwindcss/vite'
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss()],
|
||||
server: {
|
||||
port: 5317,
|
||||
port: 3000,
|
||||
proxy: {
|
||||
// NEGO_AGENT 서버 (:53117) — 데모는 항상 프록시 경유(/api)로 호출한다
|
||||
// NEGO_AGENT 서버 (:3300) — 데모는 항상 프록시 경유(/api)로 호출한다
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:53117',
|
||||
target: 'http://127.0.0.1:3300',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# NEGO 협상 에이전트 — Docker 일괄 실행 스크립트
|
||||
# ./run.sh 빌드 + 기동 (backend :53117, frontend :5317)
|
||||
# ./run.sh 빌드 + 기동 (backend :3300, frontend :3000)
|
||||
# ./run.sh down 중지·제거
|
||||
# ./run.sh logs 로그 팔로우
|
||||
set -euo pipefail
|
||||
@@ -21,14 +21,14 @@ fi
|
||||
|
||||
docker compose up -d --build
|
||||
|
||||
echo -n "backend(:53117) 기동 대기"
|
||||
echo -n "backend(:3300) 기동 대기"
|
||||
for _ in $(seq 1 30); do
|
||||
if curl -sf -o /dev/null http://127.0.0.1:53117/docs; then echo " ✔"; break; fi
|
||||
if curl -sf -o /dev/null http://127.0.0.1:3300/docs; then echo " ✔"; break; fi
|
||||
echo -n "."; sleep 2
|
||||
done
|
||||
curl -sf -o /dev/null http://127.0.0.1:5317/ && echo "frontend(:5317) ✔"
|
||||
curl -sf -o /dev/null http://127.0.0.1:3000/ && echo "frontend(:3000) ✔"
|
||||
|
||||
echo
|
||||
echo "데모 콘솔: http://localhost:5317"
|
||||
echo "API 문서: http://localhost:53117/docs"
|
||||
echo "데모 콘솔: http://localhost:3000"
|
||||
echo "API 문서: http://localhost:3300/docs"
|
||||
echo "중지: ./run.sh down"
|
||||
+1
-1
@@ -31,6 +31,6 @@ RUN python3.10 -m pip install --no-cache-dir torch==2.4.1 --index-url https://do
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 53117
|
||||
EXPOSE 3300
|
||||
|
||||
CMD ["python3.10", "web_main.py"]
|
||||
+3
-3
@@ -11,14 +11,14 @@
|
||||
```bash
|
||||
# 로컬
|
||||
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
||||
.venv/bin/python web_main.py # → http://localhost:53117/docs
|
||||
.venv/bin/python web_main.py # → http://localhost:3300/docs
|
||||
|
||||
# 테스트
|
||||
.venv/bin/python -m pytest tests/
|
||||
|
||||
# Docker (평가환경 재현: Ubuntu 20.04 + Python 3.10)
|
||||
docker build -t nego-agent .
|
||||
docker run -p 53117:53117 -e OPENAI_API_KEY=sk-... nego-agent
|
||||
docker run -p 3300:3300 -e OPENAI_API_KEY=sk-... nego-agent
|
||||
```
|
||||
|
||||
## API
|
||||
@@ -32,7 +32,7 @@ docker run -p 53117:53117 -e OPENAI_API_KEY=sk-... nego-agent
|
||||
|
||||
## 설정 — `config.toml` 하나 (환경 구분 없음)
|
||||
|
||||
- `[server]` 포트 53117
|
||||
- `[server]` 포트 3300
|
||||
- `[openai]` 모델·API 키 (비우면 `OPENAI_API_KEY` 환경변수)
|
||||
- `[profiling]` N-profiling(LLM 톤 변환) on/off — 요청 body의 `profiling: true/false`로 건별 override. 키가 없으면 자동 비활성으로 기동
|
||||
- `[instrument]` 계측 경로 — 비우면 끔
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[server]
|
||||
name = "NEGO_AGENT"
|
||||
port = 53117
|
||||
port = 3300
|
||||
host = "0.0.0.0"
|
||||
|
||||
[openai]
|
||||
|
||||
@@ -5,7 +5,7 @@ from pydantic import BaseModel
|
||||
|
||||
class ServerConfig(BaseModel):
|
||||
name: str = "NEGO_AGENT"
|
||||
port: int = 53117
|
||||
port: int = 3300
|
||||
host: str = "0.0.0.0"
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
# python web_main.py
|
||||
#
|
||||
# 또는 uvicorn 직접 실행:
|
||||
# uvicorn router.router:app --host 0.0.0.0 --port 53117
|
||||
# uvicorn router.router:app --host 0.0.0.0 --port 3300
|
||||
|
||||
import uvicorn
|
||||
|
||||
|
||||
Reference in new issue
Block a user