refactor: 统一 Playground 上下文目录与引用路径
This commit is contained in:
@@ -61,7 +61,7 @@ import {
|
||||
selectFilter,
|
||||
countRounds,
|
||||
} from '../../helpers';
|
||||
import { usePlayground } from '../../contexts/PlaygroundContext';
|
||||
import { usePlayground } from '../../context/Playground';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
|
||||
const ChatArea = ({
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { useSpeechRecognition } from '../../hooks/playground/useSpeechRecognition';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { usePlayground } from '../../contexts/PlaygroundContext';
|
||||
import { usePlayground } from '../../context/Playground';
|
||||
import {
|
||||
getExperienceCenterBool,
|
||||
getExperienceCenterPositiveInt,
|
||||
|
||||
@@ -41,7 +41,7 @@ import { useTranslation } from 'react-i18next';
|
||||
// 同名遮蔽在 Vite/terser 生产构建里会把两者缩成同一个变量名,触发 TDZ 错误:
|
||||
// "Cannot access 'Oe' before initialization"
|
||||
// 本地函数签名是 (content) 而非 helpers 里的 (message),调用时记得传 message.content。
|
||||
import { usePlayground } from '../../contexts/PlaygroundContext';
|
||||
import { usePlayground } from '../../context/Playground';
|
||||
import { useSpeechSynthesis } from '../../hooks/playground/useSpeechSynthesis';
|
||||
|
||||
const MessageContent = ({
|
||||
|
||||
@@ -17,10 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { createContext, createElement, useContext } from 'react';
|
||||
|
||||
/**
|
||||
* Context for Playground component to share image handling functionality
|
||||
* Share Playground input, upload, search, and image generation functionality.
|
||||
*/
|
||||
const PlaygroundContext = createContext(null);
|
||||
|
||||
@@ -73,11 +73,7 @@ export const usePlayground = () => {
|
||||
* @returns {JSX.Element} Provider component
|
||||
*/
|
||||
export const PlaygroundProvider = ({ children, value }) => {
|
||||
return (
|
||||
<PlaygroundContext.Provider value={value}>
|
||||
{children}
|
||||
</PlaygroundContext.Provider>
|
||||
);
|
||||
return createElement(PlaygroundContext.Provider, { value }, children);
|
||||
};
|
||||
|
||||
export default PlaygroundContext;
|
||||
@@ -95,7 +95,7 @@ import MessageSelectableWrapper from '../../components/playground/MessageSelecta
|
||||
import FloatingButtons from '../../components/playground/FloatingButtons';
|
||||
import SessionSidebar from '../../components/playground/SessionSidebar';
|
||||
import KeyboardShortcutsModal from '../../components/playground/KeyboardShortcutsModal';
|
||||
import { PlaygroundProvider } from '../../contexts/PlaygroundContext';
|
||||
import { PlaygroundProvider } from '../../context/Playground';
|
||||
|
||||
const Playground = ({ isExperienceMode = false }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
Reference in New Issue
Block a user