-

{
- // Fetch fresh avatar from API when component mounts
- if (img && record.value.author?.did) {
- fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(record.value.author.did)}`)
- .then(res => res.json())
- .then(data => {
- if (data.avatar && img) {
- img.src = data.avatar;
- }
- })
- .catch(err => {
- console.warn('Failed to fetch fresh avatar:', err);
- // Keep placeholder on error
- });
- }
- }}
- />
-
+ aiChatHistory.map((record, index) => {
+ // 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 displayName = isAiResponse ? 'AI' : (record.value.author?.displayName || record.value.author?.handle);
+
+ return (
+
+
+

{
+ // Fetch fresh avatar from API when component mounts
+ if (img && displayDid) {
+ fetch(`${appConfig.bskyPublicApi}/xrpc/app.bsky.actor.getProfile?actor=${encodeURIComponent(displayDid)}`)
+ .then(res => res.json())
+ .then(data => {
+ if (data.avatar && img) {
+ img.src = data.avatar;
+ }
+ })
+ .catch(err => {
+ // Keep placeholder on error
+ });
+ }
+ }}
+ />
+
{new Date(record.value.createdAt).toLocaleString()}
@@ -1253,16 +1350,16 @@ function App() {
{showJsonFor === record.uri ? 'Hide' : 'JSON'}
- {record.value.question || record.value.answer}
+ {record.value.text}
@@ -1276,7 +1373,8 @@ function App() {