@oscloudlab/vgen-agent-assistant 0.0.9 → 0.0.10

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.
@@ -1,4 +1,4 @@
1
- import { VgenAgentProps } from './type';
1
+ import { VgenAgentProps, VgenAgentRefProps } from './type';
2
2
 
3
- declare const VgenAgent: import('react').ForwardRefExoticComponent<VgenAgentProps & import('react').RefAttributes<unknown>>;
3
+ declare const VgenAgent: import('react').ForwardRefExoticComponent<VgenAgentProps & import('react').RefAttributes<VgenAgentRefProps>>;
4
4
  export default VgenAgent;
@@ -227,3 +227,10 @@ export interface sessionProps {
227
227
  id: number;
228
228
  summary: string;
229
229
  }
230
+ /** VgenAgent 组件 Ref 类型定义 */
231
+ export interface VgenAgentRefProps {
232
+ /** 设置引用文本并打开输入面板 */
233
+ setQuotedText: (val: string) => void;
234
+ /** 发送消息 */
235
+ sendMsg: (val: string) => void;
236
+ }
@@ -61151,6 +61151,7 @@ const VgenAgent = forwardRef((props, ref) => {
61151
61151
  useEffect(() => {
61152
61152
  return () => {
61153
61153
  addQuoteTimer.current && clearTimeout(addQuoteTimer.current);
61154
+ sendMsgTimerRef.current && clearTimeout(sendMsgTimerRef.current);
61154
61155
  };
61155
61156
  }, []);
61156
61157
  const addQuoteTimer = useRef(null);
@@ -61169,8 +61170,20 @@ const VgenAgent = forwardRef((props, ref) => {
61169
61170
  (_b = tagsTextareaRef.current) == null ? void 0 : _b.addQuotedText(`<<<${text2}>>>`);
61170
61171
  }, 100);
61171
61172
  };
61173
+ const sendMsgTimerRef = useRef(null);
61172
61174
  useImperativeHandle(ref, () => ({
61173
- setQuotedText: (val) => setQuotedTextAndInput(val)
61175
+ setQuotedText: (val) => setQuotedTextAndInput(val),
61176
+ sendMsg: (val) => {
61177
+ setIsAiPanelOpen(true);
61178
+ sendMsgTimerRef.current && clearTimeout(sendMsgTimerRef.current);
61179
+ sendMsgTimerRef.current = setTimeout(() => {
61180
+ var _a2;
61181
+ (_a2 = tagsTextareaRef.current) == null ? void 0 : _a2.focusInput();
61182
+ handleSend({
61183
+ input: val
61184
+ });
61185
+ }, 100);
61186
+ }
61174
61187
  }));
61175
61188
  useEffect(() => {
61176
61189
  if (typeof window !== "undefined") {
Binary file