@oscloudlab/vgen-agent-assistant 0.0.11 → 0.0.12

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.
@@ -25591,14 +25591,14 @@ axiosInstance.interceptors.response.use(
25591
25591
  );
25592
25592
  function sseForChat(config, events) {
25593
25593
  var _a2;
25594
- let baseUrl = "";
25595
- for (const [prefix2, baseURL] of Object.entries(API_PREFIX_MAP)) {
25594
+ let baseUrlHere = "";
25595
+ for (const [prefix2, baseURL] of Object.entries(API_PREFIX_MAP(window.isRunInDev))) {
25596
25596
  if ((_a2 = config.url) == null ? void 0 : _a2.startsWith(prefix2)) {
25597
- baseUrl = baseURL;
25597
+ baseUrlHere = baseURL;
25598
25598
  break;
25599
25599
  }
25600
25600
  }
25601
- let fullUrl = `${baseUrl}${config.url}`;
25601
+ let fullUrl = `${baseUrlHere}${config.url}`;
25602
25602
  const token2 = localStorage.getItem(TOKEN);
25603
25603
  const tokenStr = getTokenFromCookie();
25604
25604
  const queryParams = new URLSearchParams({
@@ -61258,7 +61258,7 @@ const VgenAgent = forwardRef((props, ref) => {
61258
61258
  const [messages2, setMessages] = useState([]);
61259
61259
  const [inputValue, setInputValue] = useState("");
61260
61260
  const [showPracticeGuide, setShowPracticeGuide] = useState(false);
61261
- const [chatId, setChatId] = useState(-1);
61261
+ const [chatId, setChatId] = useState(0);
61262
61262
  const [inputPlaceholder, setInputPlaceholder] = useState("在此输入你的需求或问题...");
61263
61263
  const [sceneNow, setSceneNow] = useState("");
61264
61264
  const [generatedResources, setGeneratedResources] = useState([]);
@@ -61279,6 +61279,7 @@ const VgenAgent = forwardRef((props, ref) => {
61279
61279
  const [isMoreActionsOpen, setIsMoreActionsOpen] = useState(false);
61280
61280
  const [quotedText, setQuotedText] = useState("");
61281
61281
  const [sessionList, setSessionList] = useState([]);
61282
+ const [hasInitGet, setHasInitGet] = useState(false);
61282
61283
  const quotedTextRef = useRef("");
61283
61284
  const isDragging2 = useRef(false);
61284
61285
  const scrollRef = useRef(null);
@@ -61312,13 +61313,17 @@ const VgenAgent = forwardRef((props, ref) => {
61312
61313
  sendMsg: (val) => {
61313
61314
  setIsAiPanelOpen(true);
61314
61315
  sendMsgTimerRef.current && clearTimeout(sendMsgTimerRef.current);
61316
+ let s2 = 100;
61317
+ if (!chatId) {
61318
+ s2 = 2e3;
61319
+ }
61315
61320
  sendMsgTimerRef.current = setTimeout(() => {
61316
61321
  var _a2;
61317
61322
  (_a2 = tagsTextareaRef.current) == null ? void 0 : _a2.focusInput();
61318
61323
  handleSend({
61319
61324
  input: val
61320
61325
  });
61321
- }, 100);
61326
+ }, s2);
61322
61327
  }
61323
61328
  }));
61324
61329
  useEffect(() => {
@@ -61341,14 +61346,17 @@ const VgenAgent = forwardRef((props, ref) => {
61341
61346
  }
61342
61347
  }, [isLogin]);
61343
61348
  useEffect(() => {
61344
- setChatId(chatIdFromPorps || -1);
61349
+ setChatId(chatIdFromPorps || 0);
61345
61350
  }, [chatIdFromPorps]);
61346
61351
  useEffect(() => {
61347
61352
  if (!isLogin) {
61348
61353
  return;
61349
61354
  }
61350
- initGet();
61351
- }, [isLogin, viewMode, videoInfo, courseInfo]);
61355
+ if (isAiPanelOpen && !hasInitGet) {
61356
+ setHasInitGet(true);
61357
+ initGet();
61358
+ }
61359
+ }, [isLogin, isAiPanelOpen, hasInitGet]);
61352
61360
  const toGetAgentFormFields = async () => {
61353
61361
  const res = await getAgentFormFields();
61354
61362
  setAgentFormFields(res.data);
@@ -61751,9 +61759,10 @@ const VgenAgent = forwardRef((props, ref) => {
61751
61759
  setQuotedText("");
61752
61760
  quotedTextRef.current = "";
61753
61761
  const currnetMsgId = randomNumber(1e4, 1e5);
61762
+ const realChatId = chatIdHere || chatId || chatIdRef.current;
61754
61763
  const extraObj = {
61755
61764
  enableSearch: enableGlobalSearch,
61756
- sessionId: chatIdHere || chatId || chatIdRef.current,
61765
+ sessionId: realChatId,
61757
61766
  scene: scene || sceneNow
61758
61767
  };
61759
61768
  const traceRes = await getTraceId({
@@ -61767,7 +61776,6 @@ const VgenAgent = forwardRef((props, ref) => {
61767
61776
  message: input
61768
61777
  // 用户输入
61769
61778
  };
61770
- const realChatId = chatIdHere || chatId;
61771
61779
  const controller = chatSse(
61772
61780
  {
61773
61781
  sessionId: realChatId
Binary file
Binary file