update layout
This commit is contained in:
@@ -248,7 +248,7 @@ a.view-markdown:any-link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.post-title a {
|
.post-title a {
|
||||||
color: #1f2328;
|
color: var(--theme-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
@@ -20,19 +20,6 @@
|
|||||||
<a href="{{ post.url }}">{{ post.title }}</a>
|
<a href="{{ post.url }}">{{ post.title }}</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{% if post.excerpt %}
|
|
||||||
<p class="post-excerpt">{{ post.excerpt }}</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="post-actions">
|
|
||||||
<a href="{{ post.url }}" class="read-more">Read more</a>
|
|
||||||
{% if post.markdown_url %}
|
|
||||||
<a href="{{ post.markdown_url }}" class="view-markdown" title="View Markdown">.md</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if post.translation_url %}
|
|
||||||
<a href="{{ post.translation_url }}" class="view-translation" title="View Translation">🌐</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -431,17 +431,24 @@ function App() {
|
|||||||
if (user.did && user.did.includes('-placeholder')) {
|
if (user.did && user.did.includes('-placeholder')) {
|
||||||
// Resolving placeholder DID
|
// Resolving placeholder DID
|
||||||
try {
|
try {
|
||||||
const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(user.handle)}`);
|
let profileData;
|
||||||
if (profileResponse.ok) {
|
if (agent) {
|
||||||
const profileData = await profileResponse.json();
|
const profileResponse = await agent.getProfile({ actor: user.handle });
|
||||||
if (profileData.did) {
|
profileData = profileResponse.data;
|
||||||
// Resolved DID
|
} else {
|
||||||
return {
|
// フォールバック:public API
|
||||||
...user,
|
const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(user.handle)}`);
|
||||||
did: profileData.did
|
if (profileResponse.ok) {
|
||||||
};
|
profileData = await profileResponse.json();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (profileData.did) {
|
||||||
|
// Resolved DID
|
||||||
|
return {
|
||||||
|
...user,
|
||||||
|
did: profileData.did
|
||||||
|
};
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Failed to resolve DID
|
// Failed to resolve DID
|
||||||
}
|
}
|
||||||
@@ -580,23 +587,29 @@ function App() {
|
|||||||
sortedComments.map(async (record) => {
|
sortedComments.map(async (record) => {
|
||||||
if (!record.value.author?.avatar && record.value.author?.handle) {
|
if (!record.value.author?.avatar && record.value.author?.handle) {
|
||||||
try {
|
try {
|
||||||
// Public API でプロフィール取得
|
let profileData;
|
||||||
const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(record.value.author.handle)}`);
|
if (agent) {
|
||||||
|
// 認証されたAPIでプロフィール取得
|
||||||
if (profileResponse.ok) {
|
const profileResponse = await agent.getProfile({ actor: record.value.author.handle });
|
||||||
const profileData = await profileResponse.json();
|
profileData = profileResponse.data;
|
||||||
return {
|
} else {
|
||||||
...record,
|
// フォールバック:public API
|
||||||
value: {
|
const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(record.value.author.handle)}`);
|
||||||
...record.value,
|
if (profileResponse.ok) {
|
||||||
author: {
|
profileData = await profileResponse.json();
|
||||||
...record.value.author,
|
}
|
||||||
avatar: profileData.avatar,
|
|
||||||
displayName: profileData.displayName || record.value.author.handle,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
...record,
|
||||||
|
value: {
|
||||||
|
...record.value,
|
||||||
|
author: {
|
||||||
|
...record.value.author,
|
||||||
|
avatar: profileData.avatar,
|
||||||
|
displayName: profileData.displayName || record.value.author.handle,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Ignore enhancement errors
|
// Ignore enhancement errors
|
||||||
}
|
}
|
||||||
@@ -796,14 +809,21 @@ function App() {
|
|||||||
let resolvedDid = `did:plc:${handle.replace(/\./g, '-')}-placeholder`; // フォールバック
|
let resolvedDid = `did:plc:${handle.replace(/\./g, '-')}-placeholder`; // フォールバック
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Public APIでプロフィールを取得してDIDを解決
|
let profileData;
|
||||||
const profileResponse = await fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(handle)}`);
|
if (agent) {
|
||||||
if (profileResponse.ok) {
|
// 認証されたAPIでプロフィールを取得してDIDを解決
|
||||||
const profileData = await profileResponse.json();
|
const profileResponse = await agent.getProfile({ actor: handle });
|
||||||
if (profileData.did) {
|
profileData = profileResponse.data;
|
||||||
resolvedDid = profileData.did;
|
} 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) {
|
} catch (err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1079,7 +1099,38 @@ function App() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : null}
|
||||||
|
|
||||||
|
{/* Tab Navigation */}
|
||||||
|
<div className="tab-navigation">
|
||||||
|
<button
|
||||||
|
className={`tab-button ${activeTab === 'comments' ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveTab('comments')}
|
||||||
|
>
|
||||||
|
comment ({comments.filter(shouldShowComment).length})
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`tab-button ${activeTab === 'ai-chat' ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveTab('ai-chat')}
|
||||||
|
>
|
||||||
|
chat ({aiChatHistory.length})
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`tab-button ${activeTab === 'lang-en' ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveTab('lang-en')}
|
||||||
|
>
|
||||||
|
lang:en ({langEnRecords.length})
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`tab-button ${activeTab === 'ai-comment' ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveTab('ai-comment')}
|
||||||
|
>
|
||||||
|
feedback ({aiCommentRecords.length})
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* User Section - moved below tab navigation */}
|
||||||
|
{user && (
|
||||||
<div className="user-section">
|
<div className="user-section">
|
||||||
<div className="user-info">
|
<div className="user-info">
|
||||||
<div className="user-profile">
|
<div className="user-profile">
|
||||||
@@ -1187,38 +1238,9 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Tab Navigation */}
|
|
||||||
<div className="tab-navigation">
|
|
||||||
<button
|
|
||||||
className={`tab-button ${activeTab === 'comments' ? 'active' : ''}`}
|
|
||||||
onClick={() => setActiveTab('comments')}
|
|
||||||
>
|
|
||||||
Comments ({comments.filter(shouldShowComment).length})
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`tab-button ${activeTab === 'ai-chat' ? 'active' : ''}`}
|
|
||||||
onClick={() => setActiveTab('ai-chat')}
|
|
||||||
>
|
|
||||||
AI Chat ({aiChatHistory.length})
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`tab-button ${activeTab === 'lang-en' ? 'active' : ''}`}
|
|
||||||
onClick={() => setActiveTab('lang-en')}
|
|
||||||
>
|
|
||||||
AI Lang:en ({langEnRecords.length})
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
className={`tab-button ${activeTab === 'ai-comment' ? 'active' : ''}`}
|
|
||||||
onClick={() => setActiveTab('ai-comment')}
|
|
||||||
>
|
|
||||||
AI Comment ({aiCommentRecords.length})
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Comments List */}
|
{/* Comments List */}
|
||||||
{activeTab === 'comments' && (
|
{activeTab === 'comments' && (
|
||||||
<div className="comments-list">
|
<div className="comments-list">
|
||||||
@@ -1534,13 +1556,91 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Show authentication status on non-post pages */}
|
{/* Admin Section - User Management */}
|
||||||
{user && !appConfig.rkey && (
|
{isAdmin(user) && (
|
||||||
<div className="auth-status">
|
<div className="admin-section">
|
||||||
<p>✅ Authenticated as @{user.handle}</p>
|
<h3>管理者機能 - ユーザーリスト管理</h3>
|
||||||
<p><small>Visit a post page to comment</small></p>
|
|
||||||
</div>
|
{/* User List Form */}
|
||||||
)}
|
<div className="user-list-form">
|
||||||
|
<textarea
|
||||||
|
id="user-list-input"
|
||||||
|
name="userList"
|
||||||
|
value={userListInput}
|
||||||
|
onChange={(e) => setUserListInput(e.target.value)}
|
||||||
|
placeholder="ユーザーハンドルをカンマ区切りで入力 例: syui.ai, yui.syui.ai, user.bsky.social"
|
||||||
|
rows={3}
|
||||||
|
disabled={isPostingUserList}
|
||||||
|
/>
|
||||||
|
<div className="form-actions">
|
||||||
|
<span className="admin-hint">カンマ区切りでハンドルを入力してください</span>
|
||||||
|
<button
|
||||||
|
onClick={handlePostUserList}
|
||||||
|
disabled={isPostingUserList || !userListInput.trim()}
|
||||||
|
className="post-button"
|
||||||
|
>
|
||||||
|
{isPostingUserList ? 'Posting...' : 'Post User List'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* User List Records */}
|
||||||
|
<div className="user-list-records">
|
||||||
|
<h4>投稿されたユーザーリスト</h4>
|
||||||
|
{userListRecords.length === 0 ? (
|
||||||
|
<p className="no-user-lists">ユーザーリストがまだ投稿されていません</p>
|
||||||
|
) : (
|
||||||
|
userListRecords.map((record, index) => (
|
||||||
|
<div key={index} className="user-list-item">
|
||||||
|
<div className="user-list-header">
|
||||||
|
<span className="user-list-date">
|
||||||
|
{new Date(record.value.createdAt).toLocaleString()}
|
||||||
|
</span>
|
||||||
|
<div className="user-list-actions">
|
||||||
|
<button
|
||||||
|
onClick={() => toggleJsonDisplay(record.uri)}
|
||||||
|
className="json-button"
|
||||||
|
title="Show/Hide JSON"
|
||||||
|
>
|
||||||
|
{showJsonFor === record.uri ? 'Hide' : 'JSON'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="user-list-content">
|
||||||
|
{record.value.users && record.value.users.length > 0 && (
|
||||||
|
<div className="user-handles">
|
||||||
|
{record.value.users.map((user: any, userIndex: number) => (
|
||||||
|
<span key={userIndex} className="user-handle-tag">
|
||||||
|
@{user.handle}
|
||||||
|
{user.pds && <span className="pds-info"> ({user.pds})</span>}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="user-list-meta">
|
||||||
|
<small>URI: {record.uri}</small>
|
||||||
|
<br />
|
||||||
|
<small>Updated by: {record.value.updatedBy?.handle || 'unknown'}</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* JSON Display */}
|
||||||
|
{showJsonFor === record.uri && (
|
||||||
|
<div className="json-display">
|
||||||
|
<h5>JSON Record:</h5>
|
||||||
|
<pre className="json-content">
|
||||||
|
{JSON.stringify(record, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ const response = await fetch(`${aiConfig.host}/api/generate`, {
|
|||||||
options: {
|
options: {
|
||||||
temperature: 0.9,
|
temperature: 0.9,
|
||||||
top_p: 0.9,
|
top_p: 0.9,
|
||||||
num_predict: 80,
|
num_predict: 200,
|
||||||
repeat_penalty: 1.1,
|
repeat_penalty: 1.1,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@@ -199,7 +199,7 @@ Answer:`;
|
|||||||
options: {
|
options: {
|
||||||
temperature: 0.9,
|
temperature: 0.9,
|
||||||
top_p: 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,
|
repeat_penalty: 1.1,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
function _env() {
|
function _env() {
|
||||||
d=${0:a:h:h}
|
d=${0:a:h}
|
||||||
ailog=$d/target/release/ailog
|
ailog=$d/target/release/ailog
|
||||||
oauth=$d/oauth
|
oauth=$d/oauth
|
||||||
myblog=$d/my-blog
|
myblog=$d/my-blog
|
||||||
|
@@ -1050,7 +1050,7 @@ async fn generate_ai_content(content: &str, prompt_type: &str, ai_config: &AiCon
|
|||||||
};
|
};
|
||||||
|
|
||||||
format!(
|
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
|
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 {
|
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
|
"translate" => 3000, // Much longer for translations
|
||||||
_ => 300,
|
_ => 300,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user