Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"repo": "apffm/codespaces-react", "files": {"src/services/aiService.js": {"639625f08d6359601e009dda4d28c6ba88c6d2ea": {"t": 1785746012.1745048, "n": 4240, "h": "de62ee99ab9c7eb1", "c": "// AI Service for communicating with OpenAI and DeepSeek APIs\n\nexport const sendMessageToOpenAI = async (messages, apiKey) => {\n try {\n const response = await fetch('https://api.openai.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'gpt-3.5-turbo',\n messages: messages.map(msg => ({\n role: msg.role,\n content: msg.content\n })),\n temperature: 0.7,\n max_tokens: 1000\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Failed to get response from OpenAI');\n }\n\n const data = await response.json();\n return data.choices[0].message.content;\n } catch (error) {\n console.error('OpenAI API Error:', error);\n throw error;\n }\n};\n\nexport const sendMessageToDeepSeek = async (messages, apiKey) => {\n try {\n const response = await fetch('https://api.deepseek.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'deepseek-chat',\n messages: messages.map(msg => ({\n role: msg.role,\n content: msg.content\n })),\n temperature: 0.7,\n max_tokens: 1000\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Failed to get response from DeepSeek');\n }\n\n const data = await response.json();\n return data.choices[0].message.content;\n } catch (error) {\n console.error('DeepSeek API Error:', error);\n throw error;\n }\n};\n\nexport const generateFollowUpQuestions = async (messageContent, apiKey) => {\n try {\n const response = await fetch('https://api.openai.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: 'You are a helpful assistant generating follow-up questions. Based on the given AI response, generate 3 thoughtful, concise follow-up questions that would help the user explore the topic further or gain more insights. Format your response as a JSON array of strings. Only return the JSON array, no other text.'\n },\n {\n role: 'user',\n content: `Generate follow-up questions for this AI response: \"${messageContent}\"`\n }\n ],\n temperature: 0.7,\n max_tokens: 200\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Error generating follow-up questions');\n }\n\n const data = await response.json();\n const content = data.choices[0].message.content.trim();\n \n // Try to parse as JSON\n try {\n // Handle cases where the AI might include extra text around the JSON\n const jsonMatch = content.match(/\\[.*\\]/s);\n if (jsonMatch) {\n return JSON.parse(jsonMatch[0]);\n }\n \n // Direct parse if it's a clean JSON response\n return JSON.parse(content);\n } catch (e) {\n console.error('Failed to parse follow-up questions as JSON:', e);\n \n // Try to extract questions with regex as fallback\n const questions = content.match(/\"([^\"]+)\"/g)?.map(q => q.replace(/\"/g, '')) || [];\n \n if (questions.length > 0) {\n return questions.slice(0, 3);\n }\n \n // Default questions if all else fails\n return [\n 'Can you elaborate more on this topic?',\n 'What are some practical applications of this?',\n 'How does this relate to other areas?'\n ];\n }\n } catch (error) {\n console.error('Error generating follow-up questions:', error);\n return [\n 'Can you elaborate more on this topic?',\n 'What are some practical applications of this?',\n 'How does this relate to other areas?'\n ];\n }\n};\n"}, "c1309e6fbadaf2a7acbfd35da46e98c7d145ac39": {"t": 1785758775.1254625, "n": 4240, "h": "de62ee99ab9c7eb1", "c": "// AI Service for communicating with OpenAI and DeepSeek APIs\n\nexport const sendMessageToOpenAI = async (messages, apiKey) => {\n try {\n const response = await fetch('https://api.openai.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'gpt-3.5-turbo',\n messages: messages.map(msg => ({\n role: msg.role,\n content: msg.content\n })),\n temperature: 0.7,\n max_tokens: 1000\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Failed to get response from OpenAI');\n }\n\n const data = await response.json();\n return data.choices[0].message.content;\n } catch (error) {\n console.error('OpenAI API Error:', error);\n throw error;\n }\n};\n\nexport const sendMessageToDeepSeek = async (messages, apiKey) => {\n try {\n const response = await fetch('https://api.deepseek.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'deepseek-chat',\n messages: messages.map(msg => ({\n role: msg.role,\n content: msg.content\n })),\n temperature: 0.7,\n max_tokens: 1000\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Failed to get response from DeepSeek');\n }\n\n const data = await response.json();\n return data.choices[0].message.content;\n } catch (error) {\n console.error('DeepSeek API Error:', error);\n throw error;\n }\n};\n\nexport const generateFollowUpQuestions = async (messageContent, apiKey) => {\n try {\n const response = await fetch('https://api.openai.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${apiKey}`\n },\n body: JSON.stringify({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: 'You are a helpful assistant generating follow-up questions. Based on the given AI response, generate 3 thoughtful, concise follow-up questions that would help the user explore the topic further or gain more insights. Format your response as a JSON array of strings. Only return the JSON array, no other text.'\n },\n {\n role: 'user',\n content: `Generate follow-up questions for this AI response: \"${messageContent}\"`\n }\n ],\n temperature: 0.7,\n max_tokens: 200\n })\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(errorData.error?.message || 'Error generating follow-up questions');\n }\n\n const data = await response.json();\n const content = data.choices[0].message.content.trim();\n \n // Try to parse as JSON\n try {\n // Handle cases where the AI might include extra text around the JSON\n const jsonMatch = content.match(/\\[.*\\]/s);\n if (jsonMatch) {\n return JSON.parse(jsonMatch[0]);\n }\n \n // Direct parse if it's a clean JSON response\n return JSON.parse(content);\n } catch (e) {\n console.error('Failed to parse follow-up questions as JSON:', e);\n \n // Try to extract questions with regex as fallback\n const questions = content.match(/\"([^\"]+)\"/g)?.map(q => q.replace(/\"/g, '')) || [];\n \n if (questions.length > 0) {\n return questions.slice(0, 3);\n }\n \n // Default questions if all else fails\n return [\n 'Can you elaborate more on this topic?',\n 'What are some practical applications of this?',\n 'How does this relate to other areas?'\n ];\n }\n } catch (error) {\n console.error('Error generating follow-up questions:', error);\n return [\n 'Can you elaborate more on this topic?',\n 'What are some practical applications of this?',\n 'How does this relate to other areas?'\n ];\n }\n};\n"}}, "src/components/TeacherAI.js": {"639625f08d6359601e009dda4d28c6ba88c6d2ea": {"t": 1786068269.7402687, "n": 2732, "h": "40457afc86ba0a2f", "c": "import React, { useState } from 'react';\nimport ChatInterface from './ChatInterface';\nimport ResearchTools from './ResearchTools';\nimport VoiceInteraction from './VoiceInteraction';\nimport ApiSettings from './ApiSettings';\nimport '../styles/TeacherAI.css';\n\nconst TeacherAI = () => {\n const [activeTab, setActiveTab] = useState('chat');\n const [apiKeys, setApiKeys] = useState({\n openai: localStorage.getItem('openai_api_key') || '',\n deepseek: localStorage.getItem('deepseek_api_key') || ''\n });\n const [messages, setMessages] = useState([\n {\n role: 'assistant',\n content: \"Hello! I'm your personal teacher AI. What would you like to learn today?\"\n }\n ]);\n\n const handleApiKeySave = (keys) => {\n setApiKeys(keys);\n localStorage.setItem('openai_api_key', keys.openai);\n localStorage.setItem('deepseek_api_key', keys.deepseek);\n };\n\n return (\n <div className=\"teacher-ai-container\">\n <header className=\"teacher-ai-header\">\n <h1>Personal Teacher AI</h1>\n <nav className=\"teacher-ai-nav\">\n <button \n className={`tab-button ${activeTab === 'chat' ? 'active' : ''}`}\n onClick={() => setActiveTab('chat')}\n >\n Chat\n </button>\n <button \n className={`tab-button ${activeTab === 'research' ? 'active' : ''}`}\n onClick={() => setActiveTab('research')}\n >\n Research\n </button>\n <button \n className={`tab-button ${activeTab === 'voice' ? 'active' : ''}`}\n onClick={() => setActiveTab('voice')}\n >\n Voice\n </button>\n <button \n className={`tab-button ${activeTab === 'settings' ? 'active' : ''}`}\n onClick={() => setActiveTab('settings')}\n >\n Settings\n </button>\n </nav>\n </header>\n\n <main className=\"teacher-ai-main\">\n {activeTab === 'chat' && (\n <ChatInterface \n messages={messages} \n setMessages={setMessages} \n apiKeys={apiKeys} \n />\n )}\n {activeTab === 'research' && (\n <ResearchTools \n apiKeys={apiKeys} \n addToChat={(content) => setMessages([...messages, {role: 'system', content}])} \n />\n )}\n {activeTab === 'voice' && (\n <VoiceInteraction \n messages={messages} \n setMessages={setMessages} \n apiKeys={apiKeys} \n />\n )}\n {activeTab === 'settings' && (\n <ApiSettings \n apiKeys={apiKeys} \n onSave={handleApiKeySave} \n />\n )}\n </main>\n </div>\n );\n};\n\nexport default TeacherAI;\n"}}}} |