Align final score order with team name order in tool output
- 종료 스코어를 "원정:홈" 위치 표기에서 팀명 순서(우리팀:상대)로 정렬 — 순서 불일치로 모델이 홈 승리(8:3)를 "3:8 패배"로 오독하고 패배 서사까지 지어내던 문제 수정 - formatLineupResult 종료 스코어에 승패 명기 추가(기존엔 승패 표기 없음) - 원정 관점 회귀 테스트 추가. 프로브 실측: 동일 질문 5회 중 오독 2회 → 0회
This commit is contained in:
parent
148e26d1bb
commit
de35ef21ce
@ -141,9 +141,14 @@ export function formatLineupResult(
|
|||||||
const myPitcher = isHome ? game.homeStartingPitcher : game.awayStartingPitcher;
|
const myPitcher = isHome ? game.homeStartingPitcher : game.awayStartingPitcher;
|
||||||
const oppPitcher = isHome ? game.awayStartingPitcher : game.homeStartingPitcher;
|
const oppPitcher = isHome ? game.awayStartingPitcher : game.homeStartingPitcher;
|
||||||
// 종료 경기의 최종 스코어는 결정된 사실 — 주입 허용(진행 중 스코어와 구분).
|
// 종료 경기의 최종 스코어는 결정된 사실 — 주입 허용(진행 중 스코어와 구분).
|
||||||
|
// 점수는 팀명 순서(우리팀:상대)와 일치시키고 승패를 명기한다 — "원정:홈" 위치 표기는
|
||||||
|
// 앞의 "우리팀 vs 상대" 재배열과 어긋나 모델이 홈 승리를 패배로 오독했다.
|
||||||
|
const myScore = isHome ? game.homeScore : game.awayScore;
|
||||||
|
const oppScore = isHome ? game.awayScore : game.homeScore;
|
||||||
const finalScore =
|
const finalScore =
|
||||||
game.status === "completed" && game.awayScore != null && game.homeScore != null ?
|
game.status === "completed" && myScore != null && oppScore != null ?
|
||||||
` — 종료 ${game.awayScore}:${game.homeScore}` :
|
` — 종료 ${myScore}:${oppScore} (${teamLabel(team)} ${
|
||||||
|
myScore > oppScore ? "승" : myScore < oppScore ? "패" : "무"})` :
|
||||||
"";
|
"";
|
||||||
const head =
|
const head =
|
||||||
`${dateLabel} ${teamLabel(team)} vs ${teamLabel(oppCode)} (${game.time} ${game.stadium})${finalScore}. ` +
|
`${dateLabel} ${teamLabel(team)} vs ${teamLabel(oppCode)} (${game.time} ${game.stadium})${finalScore}. ` +
|
||||||
@ -313,10 +318,11 @@ export function formatGameStandouts(
|
|||||||
): string {
|
): string {
|
||||||
const isHome = game.homeTeamCode === team;
|
const isHome = game.homeTeamCode === team;
|
||||||
const oppCode = (isHome ? game.awayTeamCode : game.homeTeamCode) as TeamCode;
|
const oppCode = (isHome ? game.awayTeamCode : game.homeTeamCode) as TeamCode;
|
||||||
const score =
|
|
||||||
game.awayScore != null && game.homeScore != null ? `${game.awayScore}:${game.homeScore}` : "?";
|
|
||||||
const my = isHome ? game.homeScore : game.awayScore;
|
const my = isHome ? game.homeScore : game.awayScore;
|
||||||
const opp = isHome ? game.awayScore : game.homeScore;
|
const opp = isHome ? game.awayScore : game.homeScore;
|
||||||
|
// 점수는 팀명 순서(우리팀:상대)와 일치시킨다 — "원정:홈" 위치 표기는 앞의 팀명
|
||||||
|
// 재배열과 어긋나 모델이 홈 승리(8:3)를 "3:8 패배"로 오독하고 서사까지 지어냈다.
|
||||||
|
const score = my != null && opp != null ? `${my}:${opp}` : "?";
|
||||||
const result = my != null && opp != null ? (my > opp ? "승" : my < opp ? "패" : "무") : "";
|
const result = my != null && opp != null ? (my > opp ? "승" : my < opp ? "패" : "무") : "";
|
||||||
const head = `${dateLabel} ${teamLabel(team)} vs ${teamLabel(oppCode)} — 종료 ${score} (${teamLabel(team)} ${result})`;
|
const head = `${dateLabel} ${teamLabel(team)} vs ${teamLabel(oppCode)} — 종료 ${score} (${teamLabel(team)} ${result})`;
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,8 @@ describe("chatToolService", () => {
|
|||||||
"2026-05-01",
|
"2026-05-01",
|
||||||
);
|
);
|
||||||
expect(out).toContain("2026-05-01");
|
expect(out).toContain("2026-05-01");
|
||||||
expect(out).toContain("종료 3:5");
|
// 점수는 팀명 순서(우리팀:상대) — 한화(홈) 5, LG(원정) 3. 승패 명기로 오독 방지.
|
||||||
|
expect(out).toContain("종료 5:3 (한화 이글스 승)");
|
||||||
expect(out).toContain("[확정 선발 라인업]");
|
expect(out).toContain("[확정 선발 라인업]");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -359,11 +360,17 @@ describe("chatToolService", () => {
|
|||||||
|
|
||||||
it("종료 스코어와 WPA 상위 타자·투수를 기록과 함께 전한다", () => {
|
it("종료 스코어와 WPA 상위 타자·투수를 기록과 함께 전한다", () => {
|
||||||
const out = formatGameStandouts(TeamCode.HH, completed, hitters, pitchers, "2026-05-01");
|
const out = formatGameStandouts(TeamCode.HH, completed, hitters, pitchers, "2026-05-01");
|
||||||
expect(out).toContain("종료 3:8");
|
// 점수는 팀명 순서(우리팀:상대) — 한화(홈) 8, LG(원정) 3. away:home 표기는 오독 유발.
|
||||||
|
expect(out).toContain("종료 8:3 (한화 이글스 승)");
|
||||||
expect(out).toContain("양의지: 4타수 3안타 2타점 1홈런");
|
expect(out).toContain("양의지: 4타수 3안타 2타점 1홈런");
|
||||||
expect(out).toContain("곽빈: 6이닝 1실점 7K");
|
expect(out).toContain("곽빈: 6이닝 1실점 7K");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("원정 팀 관점에서는 점수·승패가 뒤집힌다", () => {
|
||||||
|
const out = formatGameStandouts(TeamCode.LG, completed, hitters, pitchers, "2026-05-01");
|
||||||
|
expect(out).toContain("종료 3:8 (LG 트윈스 패)");
|
||||||
|
});
|
||||||
|
|
||||||
it("player 인자가 활약 상위에 있으면 그 사실을 표시한다", () => {
|
it("player 인자가 활약 상위에 있으면 그 사실을 표시한다", () => {
|
||||||
const out = formatGameStandouts(TeamCode.HH, completed, hitters, pitchers, "2026-05-01", "양의지");
|
const out = formatGameStandouts(TeamCode.HH, completed, hitters, pitchers, "2026-05-01", "양의지");
|
||||||
expect(out).toContain("양의지: 4타수 3안타 2타점 1홈런 — 이 경기 활약 상위");
|
expect(out).toContain("양의지: 4타수 3안타 2타점 1홈런 — 이 경기 활약 상위");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user