);
}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index d7ffd660..7cf203d3 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -9,7 +9,14 @@ import Mermaid from '../components/Mermaid';
import ModelConfigModal from '@/components/ModelConfigModal';
import { useLanguage } from '@/contexts/LanguageContext';
-
+import { cn, t } from '@/utils/utils';
+import Footer from '@/components/common/Footer';
+import AdvancedOptions from '@/components/landing/AdvancedOptions';
+import AccessTokens from '@/components/landing/AccessTokens';
+import { getConfig } from '@/config';
+import AdvancedOptionsModal from '@/components/landing/AdvancedOptionsModal';
+
+const config = getConfig('landingPage');
const SERVER_BASE_URL = process.env.NEXT_PUBLIC_SERVER_BASE_URL || 'http://localhost:8001';
// Define the demo mermaid charts outside the component
const DEMO_FLOW_CHART = `graph TD
@@ -40,44 +47,16 @@ const DEMO_SEQUENCE_CHART = `sequenceDiagram
%% Add a note to make text more visible
Note over User,GitHub: DeepWiki supports sequence diagrams for visualizing interactions`;
-// 定义模型的接口
+// Define the model interface
interface GeneratorModel {
display_name: string;
- // 如果模型对象中还有其他字段,可以在这里添加
+ // If there are other fields in the model object, add them here
}
export default function Home() {
const router = useRouter();
const { language, setLanguage, messages } = useLanguage();
- // Create a simple translation function
- const t = (key: string, params: Record = {}): string => {
- // Split the key by dots to access nested properties
- const keys = key.split('.');
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- let value: any = messages;
-
- // Navigate through the nested properties
- for (const k of keys) {
- if (value && typeof value === 'object' && k in value) {
- value = value[k];
- } else {
- // Return the key if the translation is not found
- return key;
- }
- }
-
- // If the value is a string, replace parameters
- if (typeof value === 'string') {
- return Object.entries(params).reduce((acc: string, [paramKey, paramValue]) => {
- return acc.replace(`{${paramKey}}`, String(paramValue));
- }, value);
- }
-
- // Return the key if the value is not a string
- return key;
- };
-
const [repositoryInput, setRepositoryInput] = useState('https://github.com/AsyncFuncAI/deepwiki-open');
const [showTokenInputs, setShowTokenInputs] = useState(false);
const [generatorModelName, setGeneratorModelName] = useState('google');
@@ -88,13 +67,14 @@ export default function Home() {
const [isSubmitting, setIsSubmitting] = useState(false);
const [selectedLanguage, setSelectedLanguage] = useState(language);
const [isModelConfigModalOpen, setIsModelConfigModalOpen] = useState(false);
+ const [isAdvancedOptionsModalOpen, setIsAdvancedOptionsModalOpen] = useState(false);
// Sync the language context with the selectedLanguage state
useEffect(() => {
setLanguage(selectedLanguage);
}, [selectedLanguage, setLanguage]);
- // 获取可用的生成器模型列表
+ // Fetch available generators
useEffect(() => {
const fetchGenerators = async () => {
try {
@@ -109,7 +89,7 @@ export default function Home() {
const data = await response.json();
console.log('Response:', response.json);
setAvailableModels(data);
- // 如果模型列表不为空且当前选择的模型不在列表中,则选择默认模型
+ // If the model list is not empty and the current selected model is not in the list, select the default model
if (Object.keys(data).length > 0 && !data[generatorModelName]) {
console.log('Selected model in fetch:', Object.keys(data)[0]);
setGeneratorModelName(Object.keys(data)[0]);
@@ -250,36 +230,64 @@ export default function Home() {
// The isSubmitting state will be reset when the component unmounts during navigation
};
+ const AdvancedOptionsComponent = () => {
+ return (
+ <>
+ {/* Advanced options section with improved layout */}
+
+
+ {/* Access tokens button */}
+
+ >
+ )
+ }
+
return (
-