diff --git a/my-blog/static/index.html b/my-blog/static/index.html index 456c9d6..ab36e33 100644 --- a/my-blog/static/index.html +++ b/my-blog/static/index.html @@ -1,3 +1,3 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/my-blog/templates/oauth-assets.html b/my-blog/templates/oauth-assets.html index 456c9d6..ab36e33 100644 --- a/my-blog/templates/oauth-assets.html +++ b/my-blog/templates/oauth-assets.html @@ -1,3 +1,3 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/oauth/src/App.tsx b/oauth/src/App.tsx index 3cab931..928a565 100644 --- a/oauth/src/App.tsx +++ b/oauth/src/App.tsx @@ -28,6 +28,7 @@ function App() { const [aiChatHistory, setAiChatHistory] = useState([]); const [langEnRecords, setLangEnRecords] = useState([]); const [aiCommentRecords, setAiCommentRecords] = useState([]); + const [aiProfile, setAiProfile] = useState(null); useEffect(() => { // Setup Jetstream WebSocket for real-time comments (optional) @@ -88,6 +89,20 @@ function App() { // Load AI chat history (認証状態に関係なく、全ユーザーのチャット履歴を表示) loadAiChatHistory(); + + // Load AI profile + const fetchAiProfile = async () => { + try { + const response = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(appConfig.aiDid)}`); + if (response.ok) { + const data = await response.json(); + setAiProfile(data); + } + } catch (err) { + // Use default values if fetch fails + } + }; + fetchAiProfile(); // Handle popstate events for mock OAuth flow const handlePopState = () => { @@ -966,7 +981,7 @@ function App() { {authorInfo?.displayName || 'AI'} - @{authorInfo?.handle || 'ai'} + @{authorInfo?.handle || aiProfile?.handle || 'yui.syui.ai'} @@ -1312,7 +1327,7 @@ function App() { // For AI responses, use AI DID; for user questions, use the actual author const isAiResponse = record.value.type === 'answer'; const displayDid = isAiResponse ? appConfig.aiDid : record.value.author?.did; - const displayHandle = isAiResponse ? 'ai.syui' : record.value.author?.handle; + const displayHandle = isAiResponse ? (aiProfile?.handle || 'yui.syui.ai') : record.value.author?.handle; const displayName = isAiResponse ? 'AI' : (record.value.author?.displayName || record.value.author?.handle); return ( @@ -1446,7 +1461,7 @@ function App() { AI - @ai + @{aiProfile?.handle || 'yui.syui.ai'}