AI Chat History
@@ -1222,7 +1313,6 @@ function App() {
}
})
.catch(err => {
- console.warn('Failed to fetch fresh avatar:', err);
// Keep placeholder on error
});
}
@@ -1287,37 +1377,9 @@ function App() {
{langEnRecords.length === 0 ? (
No English translations yet
) : (
- langEnRecords.map((record, index) => (
-
-
-

-
-
- {record.value.author?.displayName || 'AI Translator'}
-
-
- @{record.value.author?.handle || 'ai'}
-
-
-
- {new Date(record.value.createdAt).toLocaleString()}
-
-
-
-
Type: {record.value.type || 'en'}
-
{record.value.body}
-
-
-
- ))
+ langEnRecords.map((record, index) =>
+ renderAIContent(record, index, 'lang-item')
+ )
)}
)}
@@ -1328,37 +1390,9 @@ function App() {
{aiCommentRecords.length === 0 ? (
No AI comments yet
) : (
- aiCommentRecords.map((record, index) => (
-
-
-

-
-
- {record.value.author?.displayName || 'AI Commenter'}
-
-
- @{record.value.author?.handle || 'ai'}
-
-
-
- {new Date(record.value.createdAt).toLocaleString()}
-
-
-
-
Type: {record.value.type || 'comment'}
-
{record.value.body}
-
-
-
- ))
+ aiCommentRecords.map((record, index) =>
+ renderAIContent(record, index, 'ai-comment-item')
+ )
)}
)}
diff --git a/oauth/src/config/app.ts b/oauth/src/config/app.ts
index 5779f30..3e1952a 100644
--- a/oauth/src/config/app.ts
+++ b/oauth/src/config/app.ts
@@ -12,17 +12,25 @@ export interface AppConfig {
aiModel: string;
aiHost: string;
bskyPublicApi: string;
+ atprotoApi: string;
}
// Collection name builders (similar to Rust implementation)
export function getCollectionNames(base: string) {
- return {
+ if (!base) {
+ // Fallback to default
+ base = 'ai.syui.log';
+ }
+
+ const collections = {
comment: base,
user: `${base}.user`,
chat: `${base}.chat`,
chatLang: `${base}.chat.lang`,
chatComment: `${base}.chat.comment`,
};
+
+ return collections;
}
// Generate collection names from host
@@ -43,9 +51,9 @@ function generateBaseCollectionFromHost(host: string): string {
// Reverse the parts for collection naming
// log.syui.ai -> ai.syui.log
const reversedParts = parts.reverse();
- return reversedParts.join('.');
+ const result = reversedParts.join('.');
+ return result;
} catch (error) {
- console.warn('Failed to generate collection base from host:', host, error);
// Fallback to default
return 'ai.syui.log';
}
@@ -66,8 +74,15 @@ export function getAppConfig(): AppConfig {
// Priority: Environment variables > Auto-generated from host
const autoGeneratedBase = generateBaseCollectionFromHost(host);
+ let baseCollection = import.meta.env.VITE_OAUTH_COLLECTION || autoGeneratedBase;
+
+ // Ensure base collection is never undefined
+ if (!baseCollection) {
+ baseCollection = 'ai.syui.log';
+ }
+
const collections = {
- base: import.meta.env.VITE_OAUTH_COLLECTION || autoGeneratedBase,
+ base: baseCollection,
};
const rkey = extractRkeyFromUrl();
@@ -79,15 +94,8 @@ export function getAppConfig(): AppConfig {
const aiModel = import.meta.env.VITE_AI_MODEL || 'gemma2:2b';
const aiHost = import.meta.env.VITE_AI_HOST || 'https://ollama.syui.ai';
const bskyPublicApi = import.meta.env.VITE_BSKY_PUBLIC_API || 'https://public.api.bsky.app';
+ const atprotoApi = import.meta.env.VITE_ATPROTO_API || 'https://bsky.social';
- console.log('App configuration:', {
- host,
- adminDid,
- collections,
- rkey: rkey || 'none (not on post page)',
- ai: { enabled: aiEnabled, askAi: aiAskAi, provider: aiProvider, model: aiModel, host: aiHost },
- bskyPublicApi
- });
return {
adminDid,
@@ -99,7 +107,8 @@ export function getAppConfig(): AppConfig {
aiProvider,
aiModel,
aiHost,
- bskyPublicApi
+ bskyPublicApi,
+ atprotoApi
};
}
diff --git a/oauth/src/services/api.ts b/oauth/src/services/api.ts
index 778a25a..3c2d48d 100644
--- a/oauth/src/services/api.ts
+++ b/oauth/src/services/api.ts
@@ -73,7 +73,6 @@ export const aiCardApi = {
});
return response.data.data;
} catch (error) {
- console.warn('ai.gpt AI分析機能が利用できません:', error);
throw new Error('AI分析機能を利用するにはai.gptサーバーが必要です');
}
},
@@ -86,7 +85,6 @@ export const aiCardApi = {
const response = await aiGptApi.get('/card_get_gacha_stats');
return response.data.data;
} catch (error) {
- console.warn('ai.gpt AI統計機能が利用できません:', error);
throw new Error('AI統計機能を利用するにはai.gptサーバーが必要です');
}
},
diff --git a/oauth/src/services/atproto-oauth.ts b/oauth/src/services/atproto-oauth.ts
index e4851bf..f5b71ab 100644
--- a/oauth/src/services/atproto-oauth.ts
+++ b/oauth/src/services/atproto-oauth.ts
@@ -31,11 +31,11 @@ class AtprotoOAuthService {
private async _doInitialize(): Promise