feat: expand live chat and work server tools
This commit is contained in:
@@ -25,6 +25,7 @@ import { chatRuntimeService, type ChatRuntimeJobDetail, type ChatRuntimeSnapshot
|
||||
import { hasErrorLogViewAccessToken } from './error-log-service.js';
|
||||
import { WEB_PUSH_SUBSCRIPTION_TABLE } from './notification-service.js';
|
||||
import { createNotificationMessage } from './notification-message-service.js';
|
||||
import { extractChatMessageParts, type ChatMessagePart } from './chat-message-parts.js';
|
||||
import {
|
||||
findLatestPlanItem,
|
||||
findPlanItemByPreviewUrl,
|
||||
@@ -47,6 +48,7 @@ type ChatMessage = {
|
||||
text: string;
|
||||
timestamp: string;
|
||||
clientRequestId?: string | null;
|
||||
parts?: ChatMessagePart[];
|
||||
};
|
||||
|
||||
type ChatContext = {
|
||||
@@ -392,13 +394,14 @@ function createChatMessageId() {
|
||||
return Date.now() * 1_000 + chatMessageSequence;
|
||||
}
|
||||
|
||||
function createMessage(author: ChatAuthor, text: string, clientRequestId?: string | null): ChatMessage {
|
||||
function createMessage(author: ChatAuthor, text: string, clientRequestId?: string | null, parts?: ChatMessagePart[]): ChatMessage {
|
||||
return {
|
||||
id: createChatMessageId(),
|
||||
author,
|
||||
text,
|
||||
timestamp: formatTime(new Date()),
|
||||
clientRequestId: clientRequestId?.trim() || null,
|
||||
parts: Array.isArray(parts) ? parts : [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1511,6 +1514,7 @@ export function buildAgenticCodexPrompt(
|
||||
'- 사실성보다 추측을 우선하지 마세요. 오늘/최신/건수 질문은 직접 확인하세요.',
|
||||
'- 코드 수정이 필요 없는 질문이면 파일을 수정하지 마세요.',
|
||||
'- 첨부파일 경로, 세션 리소스 경로, preview URL은 본문에 장황하게 나열하지 말고 꼭 필요한 설명만 남기세요.',
|
||||
'- 링크를 본문과 분리된 결과 컴포넌트로 보여줘야 하면 최종 답변에 `[[link-card:제목|URL|버튼라벨]]` 한 줄 문법을 사용하세요. 이 줄은 화면에서 별도 링크 카드로 렌더됩니다.',
|
||||
'- 코드 수정을 했다면 최종 답변에 변경 이력을 기본으로 ```diff 코드블록으로 포함하세요.',
|
||||
'- 코드 수정이 있으면 마지막에 변경한 파일 경로를 짧게 적으세요.',
|
||||
'- 한국어로 간결하게 답하세요.',
|
||||
@@ -2405,6 +2409,7 @@ export class ChatService {
|
||||
text: message.text,
|
||||
timestamp: message.timestamp,
|
||||
clientRequestId: message.clientRequestId ?? null,
|
||||
parts: message.parts ?? [],
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -3402,7 +3407,13 @@ export class ChatService {
|
||||
|
||||
const finalCodexReplyMessage = {
|
||||
...codexReplyMessage,
|
||||
text: reply,
|
||||
...(() => {
|
||||
const extracted = extractChatMessageParts(reply);
|
||||
return {
|
||||
text: extracted.strippedText,
|
||||
parts: extracted.parts,
|
||||
};
|
||||
})(),
|
||||
timestamp: resolveResponseTimestamp(request.requestedAtMs),
|
||||
};
|
||||
|
||||
@@ -3455,9 +3466,11 @@ export class ChatService {
|
||||
error instanceof ChatRuntimeExecutionError ? error.responseText : '';
|
||||
|
||||
if (failureResponseText) {
|
||||
const extractedFailureReply = extractChatMessageParts(failureResponseText);
|
||||
const failedCodexReplyMessage = {
|
||||
...codexReplyMessage,
|
||||
text: failureResponseText,
|
||||
text: extractedFailureReply.strippedText,
|
||||
parts: extractedFailureReply.parts,
|
||||
timestamp: resolveResponseTimestamp(request.requestedAtMs),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user