♻️ refactor(helpers): refactor the helpers folder and related imports
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SSE } from 'sse';
|
||||
import { getUserIdFromLocalStorage } from '../helpers/index.js';
|
||||
import {
|
||||
API_ENDPOINTS,
|
||||
MESSAGE_STATUS,
|
||||
DEBUG_TABS
|
||||
} from '../constants/playground.constants';
|
||||
import {
|
||||
buildApiPayload,
|
||||
handleApiError
|
||||
} from '../helpers/apiUtils';
|
||||
import {
|
||||
getUserIdFromLocalStorage,
|
||||
handleApiError,
|
||||
processThinkTags,
|
||||
processIncompleteThinkTags
|
||||
} from '../helpers/messageUtils';
|
||||
} from '../helpers';
|
||||
|
||||
export const useApiRequest = (
|
||||
setMessage,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../helpers/api';
|
||||
import { API, processModelsData, processGroupsData } from '../helpers';
|
||||
import { API_ENDPOINTS } from '../constants/playground.constants';
|
||||
import { processModelsData, processGroupsData } from '../helpers/apiUtils';
|
||||
|
||||
export const useDataLoader = (
|
||||
userState,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useCallback } from 'react';
|
||||
import { Toast, Modal } from '@douyinfe/semi-ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getTextContent } from '../helpers/messageUtils';
|
||||
import { getTextContent } from '../helpers';
|
||||
import { ERROR_MESSAGES } from '../constants/playground.constants';
|
||||
|
||||
export const useMessageActions = (message, setMessage, onMessageSend, saveMessages) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useCallback, useState, useRef } from 'react';
|
||||
import { Toast, Modal } from '@douyinfe/semi-ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getTextContent, buildApiPayload, createLoadingAssistantMessage } from '../helpers/messageUtils';
|
||||
import { getTextContent, buildApiPayload, createLoadingAssistantMessage } from '../helpers';
|
||||
import { MESSAGE_ROLES } from '../constants/playground.constants';
|
||||
|
||||
export const useMessageEdit = (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, useCallback, useRef, useEffect } from 'react';
|
||||
import { DEFAULT_MESSAGES, DEFAULT_CONFIG, DEBUG_TABS, MESSAGE_STATUS } from '../constants/playground.constants';
|
||||
import { loadConfig, saveConfig, loadMessages, saveMessages } from '../components/playground/configStorage';
|
||||
import { processIncompleteThinkTags } from '../helpers/messageUtils';
|
||||
import { processIncompleteThinkTags } from '../helpers';
|
||||
|
||||
export const usePlaygroundState = () => {
|
||||
// 使用惰性初始化,确保只在组件首次挂载时加载配置和消息
|
||||
|
||||
Reference in New Issue
Block a user