diff --git a/my-blog/static/css/style.css b/my-blog/static/css/style.css index 6591d80..52b9ed2 100644 --- a/my-blog/static/css/style.css +++ b/my-blog/static/css/style.css @@ -248,7 +248,7 @@ a.view-markdown:any-link { } .post-title a { - color: #1f2328; + color: var(--theme-color); text-decoration: none; font-size: 18px; font-weight: 600; diff --git a/my-blog/templates/index.html b/my-blog/templates/index.html index 1de63ca..2ba6f82 100644 --- a/my-blog/templates/index.html +++ b/my-blog/templates/index.html @@ -20,19 +20,6 @@ {{ post.title }} - {% if post.excerpt %} -

{{ post.excerpt }}

- {% endif %} - -
- Read more - {% if post.markdown_url %} - .md - {% endif %} - {% if post.translation_url %} - 🌐 - {% endif %} -
{% endfor %} diff --git a/oauth/src/App.tsx b/oauth/src/App.tsx index 928a565..d3794cf 100644 --- a/oauth/src/App.tsx +++ b/oauth/src/App.tsx @@ -431,17 +431,24 @@ function App() { if (user.did && user.did.includes('-placeholder')) { // Resolving placeholder DID try { - const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(user.handle)}`); - if (profileResponse.ok) { - const profileData = await profileResponse.json(); - if (profileData.did) { - // Resolved DID - return { - ...user, - did: profileData.did - }; + let profileData; + if (agent) { + const profileResponse = await agent.getProfile({ actor: user.handle }); + profileData = profileResponse.data; + } else { + // フォールバック:public API + const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(user.handle)}`); + if (profileResponse.ok) { + profileData = await profileResponse.json(); } } + if (profileData.did) { + // Resolved DID + return { + ...user, + did: profileData.did + }; + } } catch (err) { // Failed to resolve DID } @@ -580,23 +587,29 @@ function App() { sortedComments.map(async (record) => { if (!record.value.author?.avatar && record.value.author?.handle) { try { - // Public API でプロフィール取得 - const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(record.value.author.handle)}`); - - if (profileResponse.ok) { - const profileData = await profileResponse.json(); - return { - ...record, - value: { - ...record.value, - author: { - ...record.value.author, - avatar: profileData.avatar, - displayName: profileData.displayName || record.value.author.handle, - } - } - }; + let profileData; + if (agent) { + // 認証されたAPIでプロフィール取得 + const profileResponse = await agent.getProfile({ actor: record.value.author.handle }); + profileData = profileResponse.data; + } else { + // フォールバック:public API + const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(record.value.author.handle)}`); + if (profileResponse.ok) { + profileData = await profileResponse.json(); + } } + return { + ...record, + value: { + ...record.value, + author: { + ...record.value.author, + avatar: profileData.avatar, + displayName: profileData.displayName || record.value.author.handle, + } + } + }; } catch (err) { // Ignore enhancement errors } @@ -796,14 +809,21 @@ function App() { let resolvedDid = `did:plc:${handle.replace(/\./g, '-')}-placeholder`; // フォールバック try { - // Public APIでプロフィールを取得してDIDを解決 - const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(handle)}`); - if (profileResponse.ok) { - const profileData = await profileResponse.json(); - if (profileData.did) { - resolvedDid = profileData.did; + let profileData; + if (agent) { + // 認証されたAPIでプロフィールを取得してDIDを解決 + const profileResponse = await agent.getProfile({ actor: handle }); + profileData = profileResponse.data; + } else { + // フォールバック:public API + const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(handle)}`); + if (profileResponse.ok) { + profileData = await profileResponse.json(); } } + if (profileData.did) { + resolvedDid = profileData.did; + } } catch (err) { } @@ -1079,7 +1099,38 @@ function App() { /> - ) : ( + ) : null} + + {/* Tab Navigation */} +
+ + + + +
+ + {/* User Section - moved below tab navigation */} + {user && (
@@ -1187,38 +1238,9 @@ function App() {
)} -
)} - {/* Tab Navigation */} -
- - - - -
- {/* Comments List */} {activeTab === 'comments' && (
@@ -1533,14 +1555,6 @@ function App() { {error &&

{error}

}
)} - - {/* Show authentication status on non-post pages */} - {user && !appConfig.rkey && ( -
-

✅ Authenticated as @{user.handle}

-

Visit a post page to comment

-
- )} @@ -1550,4 +1564,4 @@ function App() { ); } -export default App; \ No newline at end of file +export default App; diff --git a/oauth/src/components/AIChat-access.tsx b/oauth/src/components/AIChat-access.tsx index f4403a0..f808354 100644 --- a/oauth/src/components/AIChat-access.tsx +++ b/oauth/src/components/AIChat-access.tsx @@ -14,7 +14,7 @@ const response = await fetch(`${aiConfig.host}/api/generate`, { options: { temperature: 0.9, top_p: 0.9, - num_predict: 80, + num_predict: 200, repeat_penalty: 1.1, } }), diff --git a/oauth/src/components/AIChat.tsx b/oauth/src/components/AIChat.tsx index 8ebce70..642b521 100644 --- a/oauth/src/components/AIChat.tsx +++ b/oauth/src/components/AIChat.tsx @@ -199,7 +199,7 @@ Answer:`; options: { temperature: 0.9, top_p: 0.9, - num_predict: 80, // Shorter responses for faster generation + num_predict: 200, // Longer responses for better answers repeat_penalty: 1.1, } }), diff --git a/scpt/run.zsh b/scpt/run.zsh index b12cf8a..2fb5984 100755 --- a/scpt/run.zsh +++ b/scpt/run.zsh @@ -1,7 +1,7 @@ #!/bin/zsh function _env() { - d=${0:a:h:h} + d=${0:a:h} ailog=$d/target/release/ailog oauth=$d/oauth myblog=$d/my-blog diff --git a/src/commands/stream.rs b/src/commands/stream.rs index 6f1a7aa..0de6a7b 100644 --- a/src/commands/stream.rs +++ b/src/commands/stream.rs @@ -1050,7 +1050,7 @@ async fn generate_ai_content(content: &str, prompt_type: &str, ai_config: &AiCon }; format!( - "{}\n\n# 指示\nこのブログ記事を読んで、アイらしい感想を一言でください。\n- 30文字以内の短い感想\n- 技術的な内容への素朴な驚きや発見\n- 「わー!」「すごい!」など、アイらしい感嘆詞で始める\n- 簡潔で分かりやすく\n\n# ブログ記事(要約)\n{}\n\n# 出力形式\n一言の感想のみ(説明や詳細は不要):", + "{}\n\n# 指示\nこのブログ記事を読んで、アイらしい感想をください。\n- 100文字以内の感想\n- 技術的な内容への素朴な驚きや発見\n- 「わー!」「すごい!」など、アイらしい感嘆詞で始める\n- 簡潔で分かりやすく\n\n# ブログ記事(要約)\n{}\n\n# 出力形式\n感想のみ(説明や詳細は不要):", system_prompt, limited_content ) }, @@ -1058,7 +1058,7 @@ async fn generate_ai_content(content: &str, prompt_type: &str, ai_config: &AiCon }; let num_predict = match prompt_type { - "comment" => 50, // Very short for comments (about 30-40 characters) + "comment" => 150, // Longer for comments (about 100 characters) "translate" => 3000, // Much longer for translations _ => 300, };