@vibexnpm/talkx 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +65 -0
- package/dist/talkflow-sdk.esm.js +1 -1
- package/dist/talkflow-sdk.esm.js.map +1 -1
- package/dist/talkflow-sdk.standalone.js +1 -1
- package/dist/talkflow-sdk.standalone.js.map +1 -1
- package/dist/talkflow-sdk.umd.js +1 -1
- package/dist/talkflow-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/TalkFlowClient.js +23 -2
- package/src/chat/ChatClient.js +54 -1
- package/src/constants.js +24 -0
- package/src/index.js +1 -0
- package/src/talkflow/delegates.js +2 -0
- package/types/index.d.ts +65 -0
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,20 @@ export const ChatMessageType: {
|
|
|
91
91
|
readonly SYSTEM: 'SYSTEM';
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* AI 의사결정 카드 렌더 상한 — 서버가 강제하는 값의 사본(참고용, 클라 검증 불필요).
|
|
96
|
+
*
|
|
97
|
+
* <p>🔴 카드는 <b>새 {@code chatMessageType} 이 아니다</b> — 타입은 {@code TEXT} 이고 선택 요청은
|
|
98
|
+
* {@link ChatMessage#decisionRequest} 필드로 온다. 모르는 렌더러는 텍스트로 그리면 되고 그게 정상이다.
|
|
99
|
+
* 카드를 그린다면 {@code content} 를 다시 그리지 마라(같은 내용이 두 번 보인다).</p>
|
|
100
|
+
*/
|
|
101
|
+
export const DecisionCardLimits: {
|
|
102
|
+
readonly MIN_OPTIONS: 2;
|
|
103
|
+
readonly MAX_OPTIONS: 5;
|
|
104
|
+
readonly LABEL_MAX_LENGTH: 80;
|
|
105
|
+
readonly QUESTION_MAX_LENGTH: 200;
|
|
106
|
+
};
|
|
107
|
+
|
|
94
108
|
/**
|
|
95
109
|
* 서버가 보낼 수 있는 메시지 타입 값 전체 — {@link ChatMessageType} 상수와 같은 집합.
|
|
96
110
|
* <p>수신 {@link ChatMessage#chatMessageType} 비교 시 이 union 을 사용한다.</p>
|
|
@@ -728,6 +742,42 @@ export interface ChatMessage {
|
|
|
728
742
|
translations?: Record<string, string> | null;
|
|
729
743
|
/** 번역 당시 content 해시 — stale 판별용 (내부). */
|
|
730
744
|
translationsOf?: string | null;
|
|
745
|
+
/**
|
|
746
|
+
* AI 의 구조화 선택 요청(카드). 어시스턴트 메시지에만 존재하고, 일반 메시지에는 부재.
|
|
747
|
+
*
|
|
748
|
+
* <p><b>모르면 그냥 텍스트로 그려라 — 그게 정상 동작이다.</b> {@code content} 에 질문과 후보가
|
|
749
|
+
* 사람이 읽는 형태로 들어 있어 카드를 못 그려도 대화가 그대로 읽힌다.</p>
|
|
750
|
+
*
|
|
751
|
+
* <p>🔴 반대로 카드를 그린다면 {@code content} 를 <b>다시 그리지 마라</b> — 질문과 후보가 두 번 보인다.</p>
|
|
752
|
+
*/
|
|
753
|
+
decisionRequest?: DecisionRequest | null;
|
|
754
|
+
/** 사용자의 선택. 어느 카드인지는 {@code replyTo} 가 특정한다. */
|
|
755
|
+
decisionResponse?: DecisionResponse | null;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* AI 가 낸 선택 요청 — 질문 + 후보 2~5개.
|
|
760
|
+
*
|
|
761
|
+
* <p>후보는 <b>서버가 방의 실제 첨부에서</b> 만든다(클라가 만들거나 편집하지 않는다).</p>
|
|
762
|
+
*/
|
|
763
|
+
export interface DecisionRequest {
|
|
764
|
+
/** 사용자에게 보일 질문 — 최대 200자. */
|
|
765
|
+
question: string;
|
|
766
|
+
/** 선택지 2~5개. 라벨은 이 카드 안에서 유일하다. */
|
|
767
|
+
options: DecisionOption[];
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export interface DecisionOption {
|
|
771
|
+
/** 불투명 식별자 — 선택 전송 시 {@code decisionResponse.optionId} 로 <b>그대로</b> 돌려보낸다. */
|
|
772
|
+
id: string;
|
|
773
|
+
/** 버튼에 보일 이름 — 최대 80자(초과분은 서버가 말줄임). */
|
|
774
|
+
label: string;
|
|
775
|
+
/** 보조 설명(업로드 시각 등). 없을 수 있다. */
|
|
776
|
+
hint?: string | null;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
export interface DecisionResponse {
|
|
780
|
+
optionId: string;
|
|
731
781
|
}
|
|
732
782
|
|
|
733
783
|
/** 채팅방 참가자. */
|
|
@@ -1145,6 +1195,11 @@ export interface SendMessageData {
|
|
|
1145
1195
|
*/
|
|
1146
1196
|
separateFiles?: boolean;
|
|
1147
1197
|
replyToMessageId?: string;
|
|
1198
|
+
/**
|
|
1199
|
+
* 의사결정 카드의 선택 — 카드 버튼을 눌렀을 때만. {@link ChatClient#sendDecisionChoice} 가
|
|
1200
|
+
* {@code replyToMessageId}/{@code message}/{@code optionId} 셋을 한 번에 맞춰 준다.
|
|
1201
|
+
*/
|
|
1202
|
+
decisionResponse?: DecisionResponse;
|
|
1148
1203
|
}
|
|
1149
1204
|
|
|
1150
1205
|
export interface SendMessageResult {
|
|
@@ -1637,6 +1692,11 @@ export class ChatClient implements SdkEventEmitter<ChatClientEvents> {
|
|
|
1637
1692
|
sendTextMessageOptimistic(roomId: string, message: string): OptimisticSendMessageHandle;
|
|
1638
1693
|
sendReply(roomId: string, message: string, replyToMessageId: string): Promise<SendMessageResult>;
|
|
1639
1694
|
sendReplyOptimistic(roomId: string, message: string, replyToMessageId: string): OptimisticSendMessageHandle;
|
|
1695
|
+
/**
|
|
1696
|
+
* 의사결정 카드의 선택 전송 — 답글 + 라벨 본문 + optionId 를 한 번에 맞춰 보낸다.
|
|
1697
|
+
* 직접 조립하지 말고 이 메서드를 쓰는 편이 안전하다(셋 중 하나만 빠져도 계약이 깨진다).
|
|
1698
|
+
*/
|
|
1699
|
+
sendDecisionChoice(roomId: string, card: ChatMessage, option: DecisionOption): Promise<SendMessageResult>;
|
|
1640
1700
|
|
|
1641
1701
|
uploadFile(roomId: string, file: File, options?: FileUploadOptions): Promise<SendFileInfo>;
|
|
1642
1702
|
sendFileMessage(roomId: string, files: File | File[], options?: SendFileMessageOptions): Promise<SendMessageResult>;
|
|
@@ -2000,6 +2060,11 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
2000
2060
|
sendTextMessageOptimistic(roomId: string, message: string): OptimisticSendMessageHandle;
|
|
2001
2061
|
sendReply(roomId: string, message: string, replyToMessageId: string): Promise<SendMessageResult>;
|
|
2002
2062
|
sendReplyOptimistic(roomId: string, message: string, replyToMessageId: string): OptimisticSendMessageHandle;
|
|
2063
|
+
/**
|
|
2064
|
+
* 의사결정 카드의 선택 전송 — 답글 + 라벨 본문 + optionId 를 한 번에 맞춰 보낸다.
|
|
2065
|
+
* 직접 조립하지 말고 이 메서드를 쓰는 편이 안전하다(셋 중 하나만 빠져도 계약이 깨진다).
|
|
2066
|
+
*/
|
|
2067
|
+
sendDecisionChoice(roomId: string, card: ChatMessage, option: DecisionOption): Promise<SendMessageResult>;
|
|
2003
2068
|
|
|
2004
2069
|
uploadFile(roomId: string, file: File, options?: FileUploadOptions): Promise<SendFileInfo>;
|
|
2005
2070
|
sendFileMessage(roomId: string, files: File | File[], options?: SendFileMessageOptions): Promise<SendMessageResult>;
|