@talk2view/sdk 0.3.3 → 0.5.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/event-emitter.d.ts +7 -0
- package/dist/event-emitter.d.ts.map +1 -0
- package/dist/event-emitter.js +23 -0
- package/dist/event-emitter.js.map +1 -0
- package/dist/index.d.ts +76 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -1
- package/dist/index.js.map +1 -1
- package/dist/react/T2VProvider.js +1 -1
- package/dist/react/T2VProvider.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/useT2VChat.d.ts +6 -22
- package/dist/react/useT2VChat.d.ts.map +1 -1
- package/dist/react/useT2VChat.js +34 -218
- package/dist/react/useT2VChat.js.map +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/sessions.js +20 -4
- package/dist/sessions.js.map +1 -1
- package/dist/tools.d.ts +5 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +16 -2
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/components/ApprovalCard.d.ts +10 -0
- package/dist/ui/components/ApprovalCard.d.ts.map +1 -0
- package/dist/ui/components/ApprovalCard.js +60 -0
- package/dist/ui/components/ApprovalCard.js.map +1 -0
- package/dist/ui/components/{T2VChatHeader.d.ts → ChatHeader.d.ts} +4 -4
- package/dist/ui/components/ChatHeader.d.ts.map +1 -0
- package/dist/ui/components/ChatHeader.js +126 -0
- package/dist/ui/components/ChatHeader.js.map +1 -0
- package/dist/ui/components/ChatPanel.d.ts +9 -0
- package/dist/ui/components/ChatPanel.d.ts.map +1 -0
- package/dist/ui/components/ChatPanel.js +37 -0
- package/dist/ui/components/ChatPanel.js.map +1 -0
- package/dist/ui/components/ChatWidget.d.ts +5 -0
- package/dist/ui/components/ChatWidget.d.ts.map +1 -0
- package/dist/ui/components/ChatWidget.js +27 -0
- package/dist/ui/components/ChatWidget.js.map +1 -0
- package/dist/ui/components/CodeBlock.d.ts +6 -0
- package/dist/ui/components/CodeBlock.d.ts.map +1 -0
- package/dist/ui/components/CodeBlock.js +79 -0
- package/dist/ui/components/CodeBlock.js.map +1 -0
- package/dist/ui/components/Composer.d.ts +14 -0
- package/dist/ui/components/Composer.d.ts.map +1 -0
- package/dist/ui/components/Composer.js +172 -0
- package/dist/ui/components/Composer.js.map +1 -0
- package/dist/ui/components/LoginForm.d.ts +5 -0
- package/dist/ui/components/LoginForm.d.ts.map +1 -0
- package/dist/ui/components/LoginForm.js +37 -0
- package/dist/ui/components/LoginForm.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +5 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +28 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/MessageActions.d.ts +6 -0
- package/dist/ui/components/MessageActions.d.ts.map +1 -0
- package/dist/ui/components/MessageActions.js +43 -0
- package/dist/ui/components/MessageActions.js.map +1 -0
- package/dist/ui/components/MessageBubble.d.ts +16 -0
- package/dist/ui/components/MessageBubble.d.ts.map +1 -0
- package/dist/ui/components/MessageBubble.js +71 -0
- package/dist/ui/components/MessageBubble.js.map +1 -0
- package/dist/ui/components/MessageList.d.ts +10 -0
- package/dist/ui/components/MessageList.d.ts.map +1 -0
- package/dist/ui/components/MessageList.js +69 -0
- package/dist/ui/components/MessageList.js.map +1 -0
- package/dist/ui/components/SettingsPanel.d.ts +11 -0
- package/dist/ui/components/SettingsPanel.d.ts.map +1 -0
- package/dist/ui/components/{SettingsView.js → SettingsPanel.js} +27 -27
- package/dist/ui/components/SettingsPanel.js.map +1 -0
- package/dist/ui/components/Shimmer.d.ts +2 -0
- package/dist/ui/components/Shimmer.d.ts.map +1 -0
- package/dist/ui/components/Shimmer.js +10 -0
- package/dist/ui/components/Shimmer.js.map +1 -0
- package/dist/ui/components/Talk2View.d.ts +21 -0
- package/dist/ui/components/Talk2View.d.ts.map +1 -0
- package/dist/ui/components/Talk2View.js +79 -0
- package/dist/ui/components/Talk2View.js.map +1 -0
- package/dist/ui/components/ThinkingBlock.d.ts +7 -0
- package/dist/ui/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/ui/components/ThinkingBlock.js +64 -0
- package/dist/ui/components/ThinkingBlock.js.map +1 -0
- package/dist/ui/components/ToolDisplay.d.ts +28 -0
- package/dist/ui/components/ToolDisplay.d.ts.map +1 -0
- package/dist/ui/components/ToolDisplay.js +123 -0
- package/dist/ui/components/ToolDisplay.js.map +1 -0
- package/dist/ui/components/WelcomeScreen.d.ts +6 -0
- package/dist/ui/components/WelcomeScreen.d.ts.map +1 -0
- package/dist/ui/components/WelcomeScreen.js +18 -0
- package/dist/ui/components/WelcomeScreen.js.map +1 -0
- package/dist/ui/context.d.ts +29 -0
- package/dist/ui/context.d.ts.map +1 -0
- package/dist/ui/context.js +16 -0
- package/dist/ui/context.js.map +1 -0
- package/dist/ui/index.d.ts +24 -37
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +23 -35
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/styles.d.ts +2 -0
- package/dist/ui/styles.d.ts.map +1 -0
- package/dist/ui/styles.js +91 -0
- package/dist/ui/styles.js.map +1 -0
- package/dist/ui/theme.d.ts +11 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +70 -0
- package/dist/ui/theme.js.map +1 -0
- package/package.json +3 -10
- package/dist/ui/components/LoginModal.d.ts +0 -10
- package/dist/ui/components/LoginModal.d.ts.map +0 -1
- package/dist/ui/components/LoginModal.js +0 -138
- package/dist/ui/components/LoginModal.js.map +0 -1
- package/dist/ui/components/SettingsView.d.ts +0 -11
- package/dist/ui/components/SettingsView.d.ts.map +0 -1
- package/dist/ui/components/SettingsView.js.map +0 -1
- package/dist/ui/components/T2VAssistantModal.d.ts +0 -31
- package/dist/ui/components/T2VAssistantModal.d.ts.map +0 -1
- package/dist/ui/components/T2VAssistantModal.js +0 -151
- package/dist/ui/components/T2VAssistantModal.js.map +0 -1
- package/dist/ui/components/T2VAssistantProvider.d.ts +0 -42
- package/dist/ui/components/T2VAssistantProvider.d.ts.map +0 -1
- package/dist/ui/components/T2VAssistantProvider.js +0 -66
- package/dist/ui/components/T2VAssistantProvider.js.map +0 -1
- package/dist/ui/components/T2VChatHeader.d.ts.map +0 -1
- package/dist/ui/components/T2VChatHeader.js +0 -112
- package/dist/ui/components/T2VChatHeader.js.map +0 -1
- package/dist/ui/components/T2VComposer.d.ts +0 -11
- package/dist/ui/components/T2VComposer.d.ts.map +0 -1
- package/dist/ui/components/T2VComposer.js +0 -124
- package/dist/ui/components/T2VComposer.js.map +0 -1
- package/dist/ui/components/T2VDictationAdapter.d.ts +0 -18
- package/dist/ui/components/T2VDictationAdapter.d.ts.map +0 -1
- package/dist/ui/components/T2VDictationAdapter.js +0 -126
- package/dist/ui/components/T2VDictationAdapter.js.map +0 -1
- package/dist/ui/components/T2VLoginGate.d.ts +0 -23
- package/dist/ui/components/T2VLoginGate.d.ts.map +0 -1
- package/dist/ui/components/T2VLoginGate.js +0 -11
- package/dist/ui/components/T2VLoginGate.js.map +0 -1
- package/dist/ui/components/T2VThread.d.ts +0 -25
- package/dist/ui/components/T2VThread.d.ts.map +0 -1
- package/dist/ui/components/T2VThread.js +0 -66
- package/dist/ui/components/T2VThread.js.map +0 -1
- package/dist/ui/components/T2VToolFallback.d.ts +0 -11
- package/dist/ui/components/T2VToolFallback.d.ts.map +0 -1
- package/dist/ui/components/T2VToolFallback.js +0 -209
- package/dist/ui/components/T2VToolFallback.js.map +0 -1
- package/dist/ui/runtime/convertMessage.d.ts +0 -17
- package/dist/ui/runtime/convertMessage.d.ts.map +0 -1
- package/dist/ui/runtime/convertMessage.js +0 -77
- package/dist/ui/runtime/convertMessage.js.map +0 -1
- package/dist/ui/runtime/useT2VRuntime.d.ts +0 -42
- package/dist/ui/runtime/useT2VRuntime.d.ts.map +0 -1
- package/dist/ui/runtime/useT2VRuntime.js +0 -62
- package/dist/ui/runtime/useT2VRuntime.js.map +0 -1
- package/dist/ui/themes/tailwind-preset.d.ts +0 -43
- package/dist/ui/themes/tailwind-preset.d.ts.map +0 -1
- package/dist/ui/themes/tailwind-preset.js +0 -43
- package/dist/ui/themes/tailwind-preset.js.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* T2VDictationAdapter — Records audio via MediaRecorder and transcribes
|
|
3
|
-
* via Talk2View's /v1/audio/transcriptions endpoint.
|
|
4
|
-
*
|
|
5
|
-
* Implements assistant-ui's DictationAdapter interface so the composer
|
|
6
|
-
* can start/stop dictation and receive transcribed text.
|
|
7
|
-
*/
|
|
8
|
-
import type { DictationAdapter } from '@assistant-ui/react';
|
|
9
|
-
import type { Talk2View } from '../../index';
|
|
10
|
-
export declare class T2VDictationAdapter implements DictationAdapter {
|
|
11
|
-
private readonly t2v;
|
|
12
|
-
private readonly sttModel?;
|
|
13
|
-
private readonly sttLanguage?;
|
|
14
|
-
disableInputDuringDictation: boolean;
|
|
15
|
-
constructor(t2v: Talk2View, sttModel?: string | undefined, sttLanguage?: string | undefined);
|
|
16
|
-
listen(): DictationAdapter.Session;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=T2VDictationAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VDictationAdapter.d.ts","sourceRoot":"","sources":["../../../src/ui/components/T2VDictationAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,qBAAa,mBAAoB,YAAW,gBAAgB;IAIxD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAL/B,2BAA2B,UAAQ;gBAGhB,GAAG,EAAE,SAAS,EACd,QAAQ,CAAC,EAAE,MAAM,YAAA,EACjB,WAAW,CAAC,EAAE,MAAM,YAAA;IAGvC,MAAM,IAAI,gBAAgB,CAAC,OAAO;CAsHnC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* T2VDictationAdapter — Records audio via MediaRecorder and transcribes
|
|
3
|
-
* via Talk2View's /v1/audio/transcriptions endpoint.
|
|
4
|
-
*
|
|
5
|
-
* Implements assistant-ui's DictationAdapter interface so the composer
|
|
6
|
-
* can start/stop dictation and receive transcribed text.
|
|
7
|
-
*/
|
|
8
|
-
export class T2VDictationAdapter {
|
|
9
|
-
t2v;
|
|
10
|
-
sttModel;
|
|
11
|
-
sttLanguage;
|
|
12
|
-
disableInputDuringDictation = true;
|
|
13
|
-
constructor(t2v, sttModel, sttLanguage) {
|
|
14
|
-
this.t2v = t2v;
|
|
15
|
-
this.sttModel = sttModel;
|
|
16
|
-
this.sttLanguage = sttLanguage;
|
|
17
|
-
}
|
|
18
|
-
listen() {
|
|
19
|
-
let status = { type: 'starting' };
|
|
20
|
-
const speechStartListeners = [];
|
|
21
|
-
const speechEndListeners = [];
|
|
22
|
-
const speechListeners = [];
|
|
23
|
-
let mediaRecorder = null;
|
|
24
|
-
let chunks = [];
|
|
25
|
-
const setStatus = (newStatus) => {
|
|
26
|
-
status = newStatus;
|
|
27
|
-
};
|
|
28
|
-
// Start recording
|
|
29
|
-
navigator.mediaDevices
|
|
30
|
-
.getUserMedia({ audio: true })
|
|
31
|
-
.then((stream) => {
|
|
32
|
-
mediaRecorder = new MediaRecorder(stream, {
|
|
33
|
-
mimeType: MediaRecorder.isTypeSupported('audio/webm;codecs=opus')
|
|
34
|
-
? 'audio/webm;codecs=opus'
|
|
35
|
-
: 'audio/webm',
|
|
36
|
-
});
|
|
37
|
-
chunks = [];
|
|
38
|
-
mediaRecorder.ondataavailable = (e) => {
|
|
39
|
-
if (e.data.size > 0)
|
|
40
|
-
chunks.push(e.data);
|
|
41
|
-
};
|
|
42
|
-
mediaRecorder.onstart = () => {
|
|
43
|
-
setStatus({ type: 'running' });
|
|
44
|
-
speechStartListeners.forEach((cb) => cb());
|
|
45
|
-
};
|
|
46
|
-
mediaRecorder.onstop = async () => {
|
|
47
|
-
// Stop all tracks to release the mic
|
|
48
|
-
stream.getTracks().forEach((t) => t.stop());
|
|
49
|
-
if (chunks.length === 0) {
|
|
50
|
-
setStatus({ type: 'ended', reason: 'cancelled' });
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
const blob = new Blob(chunks, { type: mediaRecorder.mimeType });
|
|
55
|
-
const formData = new FormData();
|
|
56
|
-
formData.append('file', blob, 'recording.webm');
|
|
57
|
-
if (this.sttModel)
|
|
58
|
-
formData.append('model', this.sttModel);
|
|
59
|
-
if (this.sttLanguage)
|
|
60
|
-
formData.append('language', this.sttLanguage);
|
|
61
|
-
const result = await this.t2v.transcribe(formData);
|
|
62
|
-
const transcript = result.text.trim();
|
|
63
|
-
if (transcript) {
|
|
64
|
-
const finalResult = {
|
|
65
|
-
transcript,
|
|
66
|
-
isFinal: true,
|
|
67
|
-
};
|
|
68
|
-
speechListeners.forEach((cb) => cb(finalResult));
|
|
69
|
-
speechEndListeners.forEach((cb) => cb(finalResult));
|
|
70
|
-
}
|
|
71
|
-
setStatus({ type: 'ended', reason: 'stopped' });
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
console.error('Transcription failed:', err);
|
|
75
|
-
setStatus({ type: 'ended', reason: 'error' });
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
mediaRecorder.start();
|
|
79
|
-
})
|
|
80
|
-
.catch((err) => {
|
|
81
|
-
console.error('Microphone access denied:', err);
|
|
82
|
-
setStatus({ type: 'ended', reason: 'error' });
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
get status() {
|
|
86
|
-
return status;
|
|
87
|
-
},
|
|
88
|
-
stop: async () => {
|
|
89
|
-
if (mediaRecorder && mediaRecorder.state === 'recording') {
|
|
90
|
-
mediaRecorder.stop();
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
cancel: () => {
|
|
94
|
-
if (mediaRecorder && mediaRecorder.state === 'recording') {
|
|
95
|
-
chunks = [];
|
|
96
|
-
mediaRecorder.stop();
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
onSpeechStart: (cb) => {
|
|
100
|
-
speechStartListeners.push(cb);
|
|
101
|
-
return () => {
|
|
102
|
-
const idx = speechStartListeners.indexOf(cb);
|
|
103
|
-
if (idx >= 0)
|
|
104
|
-
speechStartListeners.splice(idx, 1);
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
onSpeechEnd: (cb) => {
|
|
108
|
-
speechEndListeners.push(cb);
|
|
109
|
-
return () => {
|
|
110
|
-
const idx = speechEndListeners.indexOf(cb);
|
|
111
|
-
if (idx >= 0)
|
|
112
|
-
speechEndListeners.splice(idx, 1);
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
onSpeech: (cb) => {
|
|
116
|
-
speechListeners.push(cb);
|
|
117
|
-
return () => {
|
|
118
|
-
const idx = speechListeners.indexOf(cb);
|
|
119
|
-
if (idx >= 0)
|
|
120
|
-
speechListeners.splice(idx, 1);
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=T2VDictationAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VDictationAdapter.js","sourceRoot":"","sources":["../../../src/ui/components/T2VDictationAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,OAAO,mBAAmB;IAIX;IACA;IACA;IALnB,2BAA2B,GAAG,IAAI,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AAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAC7C,IAAI,GAAG,IAAI,CAAC;wBAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACpD,CAAC,CAAC;YACJ,CAAC;YAED,WAAW,EAAE,CAAC,EAA6C,EAAe,EAAE;gBAC1E,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC5B,OAAO,GAAG,EAAE;oBACV,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAC3C,IAAI,GAAG,IAAI,CAAC;wBAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAClD,CAAC,CAAC;YACJ,CAAC;YAED,QAAQ,EAAE,CAAC,EAA6C,EAAe,EAAE;gBACvE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACzB,OAAO,GAAG,EAAE;oBACV,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBACxC,IAAI,GAAG,IAAI,CAAC;wBAAE,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC/C,CAAC,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* T2VLoginGate — Shows LoginModal when unauthenticated, renders children when authenticated.
|
|
3
|
-
*
|
|
4
|
-
* Composable auth gate — use it to wrap T2VThread, T2VAssistantModal,
|
|
5
|
-
* or any section of your app that requires Talk2View authentication.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <T2VAssistantProvider partnerKey="pk_live_abc">
|
|
10
|
-
* <T2VLoginGate signupUrl="https://myapp.com/signup">
|
|
11
|
-
* <T2VThread />
|
|
12
|
-
* </T2VLoginGate>
|
|
13
|
-
* </T2VAssistantProvider>
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
import React from 'react';
|
|
17
|
-
export interface T2VLoginGateProps {
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
/** URL for the "Sign up" link in the login form. */
|
|
20
|
-
signupUrl?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function T2VLoginGate({ children, signupUrl }: T2VLoginGateProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
//# sourceMappingURL=T2VLoginGate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VLoginGate.d.ts","sourceRoot":"","sources":["../../../src/ui/components/T2VLoginGate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAQtE"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useT2V } from '../../react/T2VProvider';
|
|
3
|
-
import { LoginModal } from './LoginModal';
|
|
4
|
-
export function T2VLoginGate({ children, signupUrl }) {
|
|
5
|
-
const { isAuthenticated } = useT2V();
|
|
6
|
-
if (!isAuthenticated) {
|
|
7
|
-
return _jsx(LoginModal, { signupUrl: signupUrl });
|
|
8
|
-
}
|
|
9
|
-
return _jsx(_Fragment, { children: children });
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=T2VLoginGate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VLoginGate.js","sourceRoot":"","sources":["../../../src/ui/components/T2VLoginGate.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAqB;IACrE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAAC;IAErC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,KAAC,UAAU,IAAC,SAAS,EAAE,SAAS,GAAI,CAAC;IAC9C,CAAC;IAED,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* T2VThread — Pre-styled assistant-ui Thread with Talk2View branding.
|
|
3
|
-
*
|
|
4
|
-
* Renders an inline chat thread with a header bar (logo, settings, sign out).
|
|
5
|
-
* Must be used inside T2VAssistantProvider. Requires Tailwind CSS.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <T2VAssistantProvider partnerKey="pk_live_abc">
|
|
10
|
-
* <T2VThread welcomeMessage="Ask me anything!" />
|
|
11
|
-
* </T2VAssistantProvider>
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
import React from 'react';
|
|
15
|
-
export interface T2VThreadProps {
|
|
16
|
-
/** Welcome message shown before the first user message. */
|
|
17
|
-
welcomeMessage?: string;
|
|
18
|
-
/** Clickable suggestion prompts shown below the welcome message. */
|
|
19
|
-
suggestions?: {
|
|
20
|
-
prompt: string;
|
|
21
|
-
text?: React.ReactNode;
|
|
22
|
-
}[];
|
|
23
|
-
}
|
|
24
|
-
export declare function T2VThread({ welcomeMessage, suggestions }: T2VThreadProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
//# sourceMappingURL=T2VThread.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VThread.d.ts","sourceRoot":"","sources":["../../../src/ui/components/T2VThread.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAwBxC,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,WAAW,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAC;CAC5D;AAED,wBAAgB,SAAS,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,cAAc,2CAyDxE"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* T2VThread — Pre-styled assistant-ui Thread with Talk2View branding.
|
|
4
|
-
*
|
|
5
|
-
* Renders an inline chat thread with a header bar (logo, settings, sign out).
|
|
6
|
-
* Must be used inside T2VAssistantProvider. Requires Tailwind CSS.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* <T2VAssistantProvider partnerKey="pk_live_abc">
|
|
11
|
-
* <T2VThread welcomeMessage="Ask me anything!" />
|
|
12
|
-
* </T2VAssistantProvider>
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
import React, { useState } from 'react';
|
|
16
|
-
import { Thread } from '@assistant-ui/react-ui';
|
|
17
|
-
import { MarkdownTextPrimitive } from '@assistant-ui/react-markdown';
|
|
18
|
-
import remarkGfm from 'remark-gfm';
|
|
19
|
-
import { T2VToolFallback } from './T2VToolFallback';
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
const MarkdownText = () => _jsx(MarkdownTextPrimitive, { remarkPlugins: [remarkGfm], smooth: true });
|
|
22
|
-
import { T2VComposer } from './T2VComposer';
|
|
23
|
-
import { T2VChatHeader } from './T2VChatHeader';
|
|
24
|
-
import { T2V_LOGOS } from '../../react/theme';
|
|
25
|
-
import { SettingsView } from './SettingsView';
|
|
26
|
-
import { LoginModal } from './LoginModal';
|
|
27
|
-
import { useT2VAuth } from '../../react/useT2VAuth';
|
|
28
|
-
import { useT2V } from '../../react/T2VProvider';
|
|
29
|
-
import { useT2VChatActions } from './T2VAssistantProvider';
|
|
30
|
-
import { useUserPreferences } from '../../react/useUserPreferences';
|
|
31
|
-
const FONT_SCALE = {
|
|
32
|
-
small: 0.875,
|
|
33
|
-
medium: 1,
|
|
34
|
-
large: 1.125,
|
|
35
|
-
};
|
|
36
|
-
export function T2VThread({ welcomeMessage, suggestions }) {
|
|
37
|
-
const [view, setView] = useState('chat');
|
|
38
|
-
const { isAuthenticated } = useT2V();
|
|
39
|
-
const { logout } = useT2VAuth();
|
|
40
|
-
const { clearMessages } = useT2VChatActions();
|
|
41
|
-
const { preferences } = useUserPreferences();
|
|
42
|
-
const fontSize = FONT_SCALE[preferences.fontSize || 'medium'] ?? 1;
|
|
43
|
-
// Reset to chat view on logout
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
if (!isAuthenticated)
|
|
46
|
-
setView('chat');
|
|
47
|
-
}, [isAuthenticated]);
|
|
48
|
-
if (!isAuthenticated) {
|
|
49
|
-
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', justifyContent: 'center' }, children: _jsx(LoginModal, {}) }));
|
|
50
|
-
}
|
|
51
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', fontSize: `${fontSize}rem` }, children: [_jsx(T2VChatHeader, { view: view, onSettingsClick: () => setView('settings'), onBackClick: () => setView('chat'), onNewChat: clearMessages, onSignOut: () => { logout().catch(console.error); } }), view === 'settings' ? (_jsx("div", { style: { flex: 1, overflow: 'auto' }, children: _jsx(SettingsView, { onBack: () => setView('chat'), hideHeader: true }) })) : (_jsx(Thread, { welcome: {
|
|
52
|
-
message: welcomeMessage ?? 'How can I help you today?',
|
|
53
|
-
suggestions,
|
|
54
|
-
}, assistantMessage: {
|
|
55
|
-
components: {
|
|
56
|
-
Text: MarkdownText,
|
|
57
|
-
ToolFallback: T2VToolFallback,
|
|
58
|
-
},
|
|
59
|
-
}, assistantAvatar: {
|
|
60
|
-
src: T2V_LOGOS.icon,
|
|
61
|
-
fallback: 'T2V',
|
|
62
|
-
}, components: {
|
|
63
|
-
Composer: T2VComposer,
|
|
64
|
-
} }))] }));
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=T2VThread.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VThread.js","sourceRoot":"","sources":["../../../src/ui/components/T2VThread.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,8DAA8D;AAC9D,MAAM,YAAY,GAAkB,GAAG,EAAE,CAAC,KAAC,qBAAqB,IAAC,aAAa,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,SAAG,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,iBA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AAE,IAAI,EACV,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACnD,EACD,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CACrB,cAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YACvC,KAAC,YAAY,IAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,UAAU,SAAG,GACtD,CACP,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IACL,OAAO,EAAE;oBACP,OAAO,EAAE,cAAc,IAAI,2BAA2B;oBACtD,WAAW;iBACZ,EACD,gBAAgB,EAAE;oBAChB,UAAU,EAAE;wBACV,IAAI,EAAE,YAAY;wBAClB,YAAY,EAAE,eAAe;qBAC9B;iBACF,EACD,eAAe,EAAE;oBACf,GAAG,EAAE,SAAS,CAAC,IAAI;oBACnB,QAAQ,EAAE,KAAK;iBAChB,EACD,UAAU,EAAE;oBACV,QAAQ,EAAE,WAAW;iBACtB,GACD,CACH,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* T2VToolFallback — Renders tool call UI for assistant-ui Thread.
|
|
3
|
-
*
|
|
4
|
-
* When a tool call requires approval (status === "requires-action"),
|
|
5
|
-
* renders a clean inline approval card matching assistant-ui's aesthetic.
|
|
6
|
-
*
|
|
7
|
-
* When a tool call is completed, renders a compact step indicator.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
export declare const T2VToolFallback: React.FC<any>;
|
|
11
|
-
//# sourceMappingURL=T2VToolFallback.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VToolFallback.d.ts","sourceRoot":"","sources":["../../../src/ui/components/T2VToolFallback.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAgC,MAAM,OAAO,CAAC;AAKrD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CA+CzC,CAAC"}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* T2VToolFallback — Renders tool call UI for assistant-ui Thread.
|
|
4
|
-
*
|
|
5
|
-
* When a tool call requires approval (status === "requires-action"),
|
|
6
|
-
* renders a clean inline approval card matching assistant-ui's aesthetic.
|
|
7
|
-
*
|
|
8
|
-
* When a tool call is completed, renders a compact step indicator.
|
|
9
|
-
*/
|
|
10
|
-
import { useCallback, useState } from 'react';
|
|
11
|
-
import { useT2V } from '../../react/T2VProvider';
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
export const T2VToolFallback = (props) => {
|
|
14
|
-
const { toolName, toolCallId, args, isError, status, addResult } = props;
|
|
15
|
-
const { t2v } = useT2V();
|
|
16
|
-
if (status.type === 'requires-action') {
|
|
17
|
-
const description = t2v.tools.getDescription(toolName) ||
|
|
18
|
-
`The assistant wants to use ${toolName}`;
|
|
19
|
-
return (_jsx(ApprovalUI, { toolName: toolName, toolCallId: toolCallId, args: args, description: description, onDecision: (decision) => addResult(decision) }));
|
|
20
|
-
}
|
|
21
|
-
// Completed tool call — compact step indicator
|
|
22
|
-
const isDenied = isError === true;
|
|
23
|
-
return (_jsxs("div", { style: {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
gap: '6px',
|
|
27
|
-
padding: '6px 0',
|
|
28
|
-
fontSize: '0.8125rem',
|
|
29
|
-
color: 'var(--aui-muted-foreground, #888)',
|
|
30
|
-
}, children: [isDenied ? _jsx(XCircleIcon, {}) : _jsx(CheckCircleIcon, {}), _jsxs("span", { style: { color: isDenied ? 'var(--aui-destructive, #dc2626)' : undefined }, children: [isDenied ? 'Denied' : 'Used', " ", _jsx("strong", { children: toolName })] })] }));
|
|
31
|
-
};
|
|
32
|
-
/* ── Inline Approval UI ───────────────────────────────────────── */
|
|
33
|
-
function ApprovalUI({ toolName, toolCallId, args, description, onDecision, }) {
|
|
34
|
-
const [showArgs, setShowArgs] = useState(false);
|
|
35
|
-
const [editing, setEditing] = useState(false);
|
|
36
|
-
const [editedArgs, setEditedArgs] = useState('');
|
|
37
|
-
const [editError, setEditError] = useState(null);
|
|
38
|
-
const [showDeny, setShowDeny] = useState(false);
|
|
39
|
-
const [denyFeedback, setDenyFeedback] = useState('');
|
|
40
|
-
const parseEditedArgs = useCallback(() => {
|
|
41
|
-
if (!editing)
|
|
42
|
-
return undefined;
|
|
43
|
-
try {
|
|
44
|
-
const parsed = JSON.parse(editedArgs);
|
|
45
|
-
setEditError(null);
|
|
46
|
-
if (JSON.stringify(parsed) === JSON.stringify(args))
|
|
47
|
-
return undefined;
|
|
48
|
-
return parsed;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
setEditError('Invalid JSON');
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
}, [editing, editedArgs, args]);
|
|
55
|
-
const handleAllow = useCallback((action) => {
|
|
56
|
-
if (editing) {
|
|
57
|
-
const updated = parseEditedArgs();
|
|
58
|
-
if (editError)
|
|
59
|
-
return;
|
|
60
|
-
onDecision({ action, updatedInput: updated });
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
onDecision({ action });
|
|
64
|
-
}
|
|
65
|
-
}, [onDecision, editing, parseEditedArgs, editError]);
|
|
66
|
-
const handleDeny = useCallback(() => {
|
|
67
|
-
onDecision({ action: 'deny', feedback: denyFeedback || undefined });
|
|
68
|
-
}, [onDecision, denyFeedback]);
|
|
69
|
-
return (_jsxs("div", { style: {
|
|
70
|
-
margin: '8px 0',
|
|
71
|
-
borderRadius: '0.75rem',
|
|
72
|
-
border: '1px solid var(--aui-border, #e5e7eb)',
|
|
73
|
-
overflow: 'hidden',
|
|
74
|
-
fontSize: '0.875rem',
|
|
75
|
-
}, children: [_jsxs("div", { style: {
|
|
76
|
-
display: 'flex',
|
|
77
|
-
alignItems: 'center',
|
|
78
|
-
gap: '8px',
|
|
79
|
-
padding: '10px 14px',
|
|
80
|
-
borderBottom: '1px solid var(--aui-border, #e5e7eb)',
|
|
81
|
-
backgroundColor: 'var(--aui-muted, #f9fafb)',
|
|
82
|
-
}, children: [_jsx(ShieldIcon, {}), _jsx("span", { style: { fontWeight: 600, fontSize: '0.8125rem' }, children: toolName })] }), _jsxs("div", { style: { padding: '10px 14px' }, children: [_jsx("p", { style: {
|
|
83
|
-
margin: '0 0 10px',
|
|
84
|
-
fontSize: '0.8125rem',
|
|
85
|
-
color: 'var(--aui-muted-foreground, #888)',
|
|
86
|
-
lineHeight: 1.4,
|
|
87
|
-
}, children: description }), _jsxs("button", { onClick: () => { if (!editing)
|
|
88
|
-
setShowArgs((v) => !v); }, style: {
|
|
89
|
-
display: 'flex',
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
gap: '4px',
|
|
92
|
-
padding: 0,
|
|
93
|
-
border: 'none',
|
|
94
|
-
background: 'none',
|
|
95
|
-
cursor: editing ? 'default' : 'pointer',
|
|
96
|
-
fontSize: '0.75rem',
|
|
97
|
-
fontWeight: 600,
|
|
98
|
-
color: 'var(--aui-muted-foreground, #888)',
|
|
99
|
-
marginBottom: showArgs ? '8px' : 0,
|
|
100
|
-
}, children: [_jsx("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", style: { transform: showArgs ? 'rotate(0deg)' : 'rotate(-90deg)', transition: 'transform 0.15s' }, children: _jsx("polyline", { points: "6 9 12 15 18 9" }) }), "Arguments"] }), showArgs && (editing ? (_jsxs("div", { children: [_jsx("textarea", { value: editedArgs, onChange: (e) => { setEditedArgs(e.target.value); setEditError(null); }, style: {
|
|
101
|
-
width: '100%',
|
|
102
|
-
minHeight: '80px',
|
|
103
|
-
padding: '8px',
|
|
104
|
-
borderRadius: '0.5rem',
|
|
105
|
-
border: `1px solid ${editError ? 'var(--aui-destructive, #dc2626)' : 'var(--aui-border, #e5e7eb)'}`,
|
|
106
|
-
fontSize: '0.75rem',
|
|
107
|
-
fontFamily: 'monospace',
|
|
108
|
-
resize: 'vertical',
|
|
109
|
-
boxSizing: 'border-box',
|
|
110
|
-
outline: 'none',
|
|
111
|
-
} }), editError && (_jsx("div", { style: { fontSize: '0.75rem', color: 'var(--aui-destructive, #dc2626)', marginTop: '4px' }, children: editError }))] })) : (_jsxs("div", { style: { position: 'relative' }, children: [_jsx("pre", { style: {
|
|
112
|
-
margin: 0,
|
|
113
|
-
padding: '8px',
|
|
114
|
-
borderRadius: '0.5rem',
|
|
115
|
-
backgroundColor: 'var(--aui-muted, #f9fafb)',
|
|
116
|
-
border: '1px solid var(--aui-border, #e5e7eb)',
|
|
117
|
-
fontSize: '0.75rem',
|
|
118
|
-
fontFamily: 'monospace',
|
|
119
|
-
overflowX: 'auto',
|
|
120
|
-
maxHeight: '120px',
|
|
121
|
-
whiteSpace: 'pre-wrap',
|
|
122
|
-
wordBreak: 'break-word',
|
|
123
|
-
}, children: JSON.stringify(args, null, 2) }), _jsx("button", { onClick: () => {
|
|
124
|
-
setEditing(true);
|
|
125
|
-
setShowArgs(true);
|
|
126
|
-
setEditedArgs(JSON.stringify(args, null, 2));
|
|
127
|
-
}, style: {
|
|
128
|
-
position: 'absolute',
|
|
129
|
-
top: '4px',
|
|
130
|
-
right: '4px',
|
|
131
|
-
padding: '2px 8px',
|
|
132
|
-
borderRadius: '0.25rem',
|
|
133
|
-
border: '1px solid var(--aui-border, #e5e7eb)',
|
|
134
|
-
backgroundColor: 'var(--aui-background, #fff)',
|
|
135
|
-
fontSize: '0.6875rem',
|
|
136
|
-
cursor: 'pointer',
|
|
137
|
-
color: 'var(--aui-muted-foreground, #888)',
|
|
138
|
-
}, children: "Edit" })] }))), showDeny && (_jsx("div", { style: { marginTop: '8px' }, children: _jsx("input", { type: "text", placeholder: "Reason (optional)", value: denyFeedback, onChange: (e) => setDenyFeedback(e.target.value), onKeyDown: (e) => { if (e.key === 'Enter')
|
|
139
|
-
handleDeny(); }, style: {
|
|
140
|
-
width: '100%',
|
|
141
|
-
padding: '6px 8px',
|
|
142
|
-
borderRadius: '0.5rem',
|
|
143
|
-
border: '1px solid var(--aui-border, #e5e7eb)',
|
|
144
|
-
fontSize: '0.8125rem',
|
|
145
|
-
boxSizing: 'border-box',
|
|
146
|
-
outline: 'none',
|
|
147
|
-
} }) }))] }), _jsx("div", { style: {
|
|
148
|
-
display: 'flex',
|
|
149
|
-
gap: '6px',
|
|
150
|
-
padding: '8px 14px 12px',
|
|
151
|
-
}, children: !showDeny ? (_jsxs(_Fragment, { children: [_jsxs(ActionBtn, { variant: "primary", onClick: () => handleAllow('once'), children: [_jsx(CheckIcon, {}), " Allow Once"] }), _jsxs(ActionBtn, { variant: "secondary", onClick: () => handleAllow('always'), children: [_jsx(CheckDoubleIcon, {}), " Always"] }), editing ? (_jsx(ActionBtn, { variant: "ghost", onClick: () => { setEditing(false); setEditedArgs(''); setEditError(null); }, children: "Cancel" })) : (_jsxs(ActionBtn, { variant: "destructive", onClick: () => setShowDeny(true), children: [_jsx(XIcon, {}), " Deny"] }))] })) : (_jsxs(_Fragment, { children: [_jsxs(ActionBtn, { variant: "destructive", onClick: handleDeny, children: [_jsx(XIcon, {}), " Deny"] }), _jsx(ActionBtn, { variant: "ghost", onClick: () => { setShowDeny(false); setDenyFeedback(''); }, children: "Cancel" })] })) })] }));
|
|
152
|
-
}
|
|
153
|
-
/* ── Action Button ────────────────────────────────────────────── */
|
|
154
|
-
const VARIANTS = {
|
|
155
|
-
primary: {
|
|
156
|
-
base: { backgroundColor: 'var(--aui-primary, #18181b)', color: 'var(--aui-primary-foreground, #fff)' },
|
|
157
|
-
hover: { opacity: '0.9' },
|
|
158
|
-
},
|
|
159
|
-
secondary: {
|
|
160
|
-
base: { backgroundColor: 'var(--aui-muted, #f4f4f5)', color: 'var(--aui-foreground, #18181b)', border: '1px solid var(--aui-border, #e5e7eb)' },
|
|
161
|
-
hover: { backgroundColor: 'var(--aui-accent, #e4e4e7)' },
|
|
162
|
-
},
|
|
163
|
-
ghost: {
|
|
164
|
-
base: { backgroundColor: 'transparent', color: 'var(--aui-muted-foreground, #888)' },
|
|
165
|
-
hover: { backgroundColor: 'var(--aui-muted, #f4f4f5)' },
|
|
166
|
-
},
|
|
167
|
-
destructive: {
|
|
168
|
-
base: { backgroundColor: 'transparent', color: 'var(--aui-destructive, #dc2626)', border: '1px solid color-mix(in srgb, var(--aui-destructive, #dc2626) 25%, transparent)' },
|
|
169
|
-
hover: { backgroundColor: 'color-mix(in srgb, var(--aui-destructive, #dc2626) 8%, transparent)' },
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
function ActionBtn({ children, onClick, variant, }) {
|
|
173
|
-
const [hovered, setHovered] = useState(false);
|
|
174
|
-
const v = VARIANTS[variant];
|
|
175
|
-
return (_jsx("button", { onClick: onClick, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: {
|
|
176
|
-
display: 'inline-flex',
|
|
177
|
-
alignItems: 'center',
|
|
178
|
-
gap: '4px',
|
|
179
|
-
padding: '5px 12px',
|
|
180
|
-
borderRadius: '0.5rem',
|
|
181
|
-
border: 'none',
|
|
182
|
-
fontSize: '0.75rem',
|
|
183
|
-
fontWeight: 600,
|
|
184
|
-
cursor: 'pointer',
|
|
185
|
-
transition: 'all 0.15s ease',
|
|
186
|
-
...v.base,
|
|
187
|
-
...(hovered ? v.hover : {}),
|
|
188
|
-
}, children: children }));
|
|
189
|
-
}
|
|
190
|
-
/* ── Icons ────────────────────────────────────────────────────── */
|
|
191
|
-
function ShieldIcon() {
|
|
192
|
-
return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { color: 'var(--aui-muted-foreground, #888)' }, children: _jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }) }));
|
|
193
|
-
}
|
|
194
|
-
function CheckIcon() {
|
|
195
|
-
return (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }));
|
|
196
|
-
}
|
|
197
|
-
function CheckDoubleIcon() {
|
|
198
|
-
return (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("polyline", { points: "18 6 7 17 2 12" }), _jsx("polyline", { points: "22 10 13 21" })] }));
|
|
199
|
-
}
|
|
200
|
-
function XIcon() {
|
|
201
|
-
return (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
|
|
202
|
-
}
|
|
203
|
-
function CheckCircleIcon() {
|
|
204
|
-
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("polyline", { points: "9 12 12 15 16 10" })] }));
|
|
205
|
-
}
|
|
206
|
-
function XCircleIcon() {
|
|
207
|
-
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "var(--aui-destructive, #dc2626)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), _jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })] }));
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=T2VToolFallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"T2VToolFallback.js","sourceRoot":"","sources":["../../../src/ui/components/T2VToolFallback.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAkB,CAAC,KAAK,EAAE,EAAE;IACtD,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAQlE,CAAC;IAEF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAEzB,IAAI,MAAM,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACtC,MAAM,WAAW,GACf,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;YAClC,8BAA8B,QAAQ,EAAE,CAAC;QAE3C,OAAO,CACL,KAAC,UAAU,IACT,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,GAC7C,CACH,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,MAAM,QAAQ,GAAG,OAAO,KAAK,IAAI,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,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,GAAG,IAClC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* convertMessage — Converts DisplayMessage (from useT2VChat) to ThreadMessageLike (assistant-ui).
|
|
3
|
-
*
|
|
4
|
-
* Handles text, plan, tool steps, pending approvals, streaming status, and errors.
|
|
5
|
-
*/
|
|
6
|
-
import type { ThreadMessageLike } from '@assistant-ui/react';
|
|
7
|
-
import type { PendingApproval } from '../../types';
|
|
8
|
-
import type { DisplayMessage } from '../../react/useT2VChat';
|
|
9
|
-
/**
|
|
10
|
-
* Convert a Talk2View DisplayMessage into an assistant-ui ThreadMessageLike.
|
|
11
|
-
*
|
|
12
|
-
* @param msg - The DisplayMessage from useT2VChat
|
|
13
|
-
* @param pendingApproval - If this is the last assistant message and has a pending approval, pass it here
|
|
14
|
-
* @param error - If this is the last assistant message and there's an error, pass the error string
|
|
15
|
-
*/
|
|
16
|
-
export declare function convertDisplayMessage(msg: DisplayMessage, pendingApproval: PendingApproval | null, error: string | null): ThreadMessageLike;
|
|
17
|
-
//# sourceMappingURL=convertMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertMessage.d.ts","sourceRoot":"","sources":["../../../src/ui/runtime/convertMessage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,cAAc,EACnB,eAAe,EAAE,eAAe,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,iBAAiB,CAmEnB"}
|