@things-factory/ai-assistant 10.1.13 → 10.1.16
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/client/components/{board-ai-chat.ts → assistant-chat.ts} +589 -18
- package/client/components/chat-defaults.ts +24 -0
- package/client/components/chat-input-builder.ts +1 -1
- package/client/index.ts +2 -3
- package/dist-client/components/{board-ai-chat.d.ts → assistant-chat.d.ts} +39 -3
- package/dist-client/components/{board-ai-chat.js → assistant-chat.js} +597 -66
- package/dist-client/components/assistant-chat.js.map +1 -0
- package/dist-client/components/{board-ai-chat.test.js → assistant-chat.test.js} +1 -1
- package/dist-client/components/assistant-chat.test.js.map +1 -0
- package/dist-client/components/chat-defaults.d.ts +22 -0
- package/dist-client/components/chat-defaults.js +4 -0
- package/dist-client/components/chat-defaults.js.map +1 -1
- package/dist-client/components/chat-input-builder.js +1 -1
- package/dist-client/components/chat-input-builder.js.map +1 -1
- package/dist-client/index.d.ts +2 -3
- package/dist-client/index.js +2 -3
- package/dist-client/index.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/assistant-chat-resolver.js +12 -0
- package/dist-server/service/assistant-chat-resolver.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/server/service/assistant-chat-resolver.ts +13 -0
- package/test/assistant-request-context.test.ts +1 -1
- package/test/assistant-session-toolbar.test.ts +1 -1
- package/translations/en.json +6 -1
- package/translations/ko.json +6 -1
- package/dist-client/components/board-ai-chat.js.map +0 -1
- package/dist-client/components/board-ai-chat.test.js.map +0 -1
- /package/client/components/{board-ai-chat.test.ts → assistant-chat.test.ts} +0 -0
- /package/dist-client/components/{board-ai-chat.test.d.ts → assistant-chat.test.d.ts} +0 -0
|
@@ -28,6 +28,28 @@ export interface ChatDefaults {
|
|
|
28
28
|
* 그 말을 한다.
|
|
29
29
|
*/
|
|
30
30
|
footerNoticeKey?: string
|
|
31
|
+
/**
|
|
32
|
+
* Follow-up chips offered on a proposal that arrived without its own `choices`.
|
|
33
|
+
*
|
|
34
|
+
* These used to sit in the chat component as a literal array: "다른 콘셉트 재제안", "비율 슬림
|
|
35
|
+
* 조정", "색상 테마 변경", "디테일 보강". Those are a 3D modeller's words, written in Korean with
|
|
36
|
+
* no i18n, inside a component four apps share. A plant screen proposal offered to slim its
|
|
37
|
+
* aspect ratio.
|
|
38
|
+
*
|
|
39
|
+
* Same reason as `footerNoticeKey`: the host that knows what a follow-up means writes it.
|
|
40
|
+
* Leave it unset and a proposal without choices simply gets none, which is correct.
|
|
41
|
+
*/
|
|
42
|
+
proposalChoices?: any[]
|
|
43
|
+
/**
|
|
44
|
+
* The **i18n key** for the line shown once the host reports a proposal staged. Unset means the
|
|
45
|
+
* badge is never drawn.
|
|
46
|
+
*
|
|
47
|
+
* The component cannot know this on its own. It used to read "선택지가 딸려 있다" as "the model is
|
|
48
|
+
* in the 3D viewer" and say so — in a component plant and twin also use, neither of which has a
|
|
49
|
+
* 3D viewer. Staging is something the host does, so the host says whether it happened
|
|
50
|
+
* (`acknowledgeProposalStaged`) and in what words.
|
|
51
|
+
*/
|
|
52
|
+
stagedNoticeKey?: string
|
|
31
53
|
}
|
|
32
54
|
|
|
33
55
|
export const chatDefaults: ChatDefaults = { catalogEntries: [], slashTemplates: [] }
|
|
@@ -37,4 +59,6 @@ export function registerChatDefaults(defaults: Partial<ChatDefaults>): void {
|
|
|
37
59
|
if (defaults.catalogEntries) chatDefaults.catalogEntries = defaults.catalogEntries
|
|
38
60
|
if (defaults.slashTemplates) chatDefaults.slashTemplates = defaults.slashTemplates
|
|
39
61
|
if (defaults.footerNoticeKey) chatDefaults.footerNoticeKey = defaults.footerNoticeKey
|
|
62
|
+
if (defaults.proposalChoices) chatDefaults.proposalChoices = defaults.proposalChoices
|
|
63
|
+
if (defaults.stagedNoticeKey) chatDefaults.stagedNoticeKey = defaults.stagedNoticeKey
|
|
40
64
|
}
|
|
@@ -96,7 +96,7 @@ export interface AssistantChatInputArgs {
|
|
|
96
96
|
*/
|
|
97
97
|
export function buildAssistantChatInput(args: AssistantChatInputArgs): Record<string, any> {
|
|
98
98
|
if (!args.systemPrompt?.trim()) {
|
|
99
|
-
throw new Error('[ox-
|
|
99
|
+
throw new Error('[ox-assistant-chat] systemPrompt is required when the chat talks to assistantChat')
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
return {
|
package/client/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@things-factory/ai-assistant` — 대화면.
|
|
3
3
|
*
|
|
4
|
-
* `<ox-
|
|
5
|
-
* 박혀 있고, 그것을 같은 커밋에서 함께 바꾸면 무엇이 깨졌는지 못 가린다. 이름은 별도로 옮긴다.
|
|
4
|
+
* 표준 컴포넌트는 `<ox-assistant-chat>` 이다.
|
|
6
5
|
*/
|
|
7
|
-
export * from './components/
|
|
6
|
+
export * from './components/assistant-chat.js'
|
|
8
7
|
export * from './components/chat-defaults.js'
|
|
9
8
|
export * from './components/markdown.js'
|
|
10
9
|
export * from './components/chat-echo-dedup.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* <ox-
|
|
2
|
+
* <ox-assistant-chat> — AI 도우미 채팅 컴포넌트 (Lit).
|
|
3
3
|
*
|
|
4
4
|
* 입력:
|
|
5
5
|
* - sessionId: 영속 ChatSession 식별자 (없으면 ad-hoc 모드, 메시지 영속 안 됨)
|
|
@@ -19,7 +19,16 @@ import { type AssistantRequestContext } from '../utils/assistant-request-context
|
|
|
19
19
|
import { LitElement } from 'lit';
|
|
20
20
|
import './mention-popup.js';
|
|
21
21
|
import { type FilterResult } from './mention-popup.js';
|
|
22
|
-
export
|
|
22
|
+
export interface ChatAttachment {
|
|
23
|
+
id: string;
|
|
24
|
+
file: File;
|
|
25
|
+
name: string;
|
|
26
|
+
size: number;
|
|
27
|
+
type: string;
|
|
28
|
+
url: string;
|
|
29
|
+
base64?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class OxAssistantChat extends LitElement {
|
|
23
32
|
/** 영속 세션 id. 없으면 ad-hoc (메시지 영속 안 됨). */
|
|
24
33
|
sessionId?: string;
|
|
25
34
|
prepareSession?: (adopt: (id: string) => void) => Promise<string | undefined>;
|
|
@@ -182,6 +191,17 @@ export declare class OxBoardAIChat extends LitElement {
|
|
|
182
191
|
private lastFailedInput?;
|
|
183
192
|
/** 되돌려진 patch id 들 — 한 번 revert 한 patch 는 버튼 비활성 */
|
|
184
193
|
private revertedPatchIds;
|
|
194
|
+
/** 첨부된 파일/이미지 목록 */
|
|
195
|
+
private attachments;
|
|
196
|
+
/** 드래그 오버 상태 (시각 피드백용) */
|
|
197
|
+
private dragOver;
|
|
198
|
+
private onAttachFiles;
|
|
199
|
+
private readFileAsBase64;
|
|
200
|
+
private removeAttachment;
|
|
201
|
+
private onComposerPaste;
|
|
202
|
+
private onComposerDragOver;
|
|
203
|
+
private onComposerDragLeave;
|
|
204
|
+
private onComposerDrop;
|
|
185
205
|
/** mini action — 인라인 예시 토글 */
|
|
186
206
|
private examplesOpen;
|
|
187
207
|
/** 복사 toast 표시 상태 */
|
|
@@ -192,6 +212,21 @@ export declare class OxBoardAIChat extends LitElement {
|
|
|
192
212
|
private openToolSteps;
|
|
193
213
|
/** 이미 실행을 요청한 제안 키 — 같은 카드를 두 번 눌러 되돌릴 수 없는 명령이 두 번 나가지 않게. */
|
|
194
214
|
private sentProposals;
|
|
215
|
+
/** Proposal keys the host has reported staged. Only the host knows; see `acknowledgeProposalStaged`. */
|
|
216
|
+
private stagedProposals;
|
|
217
|
+
/**
|
|
218
|
+
* The host reports that it put this candidate somewhere the person can look at it.
|
|
219
|
+
*
|
|
220
|
+
* Staging happens outside this component — a dock catches `assistant-proposal-preview`, hands
|
|
221
|
+
* the candidate to a viewer, and only that host knows whether it worked, or whether it has a
|
|
222
|
+
* viewer at all. So the card says nothing until the host calls this, and it then says it in the
|
|
223
|
+
* words the host registered (`chatDefaults.stagedNoticeKey`).
|
|
224
|
+
*
|
|
225
|
+
* Safe to call for a candidate the card never showed; the key simply never matches.
|
|
226
|
+
*/
|
|
227
|
+
acknowledgeProposalStaged(proposal: any): void;
|
|
228
|
+
/** Once per page: the miss is a wiring mistake, and repeating it per candidate buries it. */
|
|
229
|
+
private static warnedMissingStagedNotice;
|
|
195
230
|
/**
|
|
196
231
|
* 이 대화가 길어져 앞부분이 프롬프트에서 접혔다는 **사실**(서버 보고). 주제 이탈을 판정한 것이
|
|
197
232
|
* 아니다 — 판정하면 오탐이 생기고, 오탐이 생기면 사용자는 안내 자체를 무시한다.
|
|
@@ -365,6 +400,7 @@ export declare class OxBoardAIChat extends LitElement {
|
|
|
365
400
|
* 실행 결과는 호스트가 **대화에 기록**한다 — 누가 무엇을 실행했는지가 협의 이력에 남아야 한다.
|
|
366
401
|
*/
|
|
367
402
|
private renderProposals;
|
|
403
|
+
private onChoiceClick;
|
|
368
404
|
/**
|
|
369
405
|
* 제안 식별 키 — 같은 조치를 두 번 실행하지 않도록 **효과**(명령·대상·인자)로만 만든다.
|
|
370
406
|
*
|
|
@@ -432,6 +468,6 @@ export declare class OxBoardAIChat extends LitElement {
|
|
|
432
468
|
}
|
|
433
469
|
declare global {
|
|
434
470
|
interface HTMLElementTagNameMap {
|
|
435
|
-
'ox-
|
|
471
|
+
'ox-assistant-chat': OxAssistantChat;
|
|
436
472
|
}
|
|
437
473
|
}
|