2025.02.05 (수)
2026.05.25 (μ›”) μˆ˜μ •

✨ GPT Summary γ€€

I implemented Diary to Chat, resolved issues that occurred during creation, and fixed emotion score and character setting errors in the AI comment system.

πŸ’» Development Log

⏰ Today’s tasks

  • βœ… Help create Custom Function - systemPromptTemplate (main worker: KSK)
    • βœ… Reviewed added parameters and internal function structure
  • βœ… Test whether Custom Function - getAIComment is actually applied
    • βœ… Confirmed input values are reflected properly
    • βœ… Confirmed output value prints properly as String
  • βœ… Chat Page - Create New Chat: apply system prompt (main worker: KSK)
    • βœ… OpenAI API Call (createChatCompletion)
      • Input: System Prompt (Chat)
      • Output: New Chat Message by AI ($.choices[0].message.content)
      • Additional Actions: Create New Chat, Create New Message
  • βœ… DiaryPage - Create New Chat by Diary: create a New Chat based on diary content (main worker: KSK)
    • βœ… OpenAI API Call (createDiaryComment)
      • Input: Diary Content, System Prompt (AI Comment)
      • Output: AI Comment ($.choices[0].message.content)
    • βœ… OpenAI API Call (createDiarySummary)
      • Input: Diary Content, AI Comment, System Prompt (Diary Summary)
      • Output: Diary Summary ($.choices[0].message.content)
    • βœ… OpenAI API Call (createChatFromDiary)
      • Input: Diary Summary, System Prompt (Chat From Diary)
      • Output: New Chat Message by AI ($.choices[0].message.content)
      • Additional Actions: Create New Chat, Create New Message
  • βœ… (Issue) Create New Chat by Diary only works after saving only the diary, returning home, entering the diary page again, and then creating New Chat.
    • Cause of the issue
      • I was pulling in an Output variable from a different action chain
      • Unexpected Null Value prevention was not in place
      • JSON Path was not specified properly
      • I had defined tmpDiariesDocForNewChat as Page State and assigned the diary Document to it.
        • More precisely,
          • I had it assign the diariesDoc passed as a Page Parameter, or
          • assign the newDiariesDoc created when pressing the Save button.
        • But the app kept freezing when pressing the Save Diary and Chat with AI button.
          • Looking with F12, an Exception was thrown because of an Unexpected Null Value error.
          • Looking at the Debug Panel, tmpDiariesDocForNewChat was set to Null.
        • Changed Page State from tmpDiariesDocForNewChat back to tmpDiariesDocRefForNewChat. (Document -> Document Reference)
          • After changing the Actions appropriately around Document Reference, it finally worked normally!
    • πŸ’‘ What I learned: In an Action Chain, assigning a value to Page State and immediately reading it can cause Unexpected Null Value. Use Document Reference a lot instead of Document. Of course, reading Document with Backend Query a lot may cause performance degradation… but that can just be handled sufficiently on OnPageLoad Event or when creating major Action Chains.
  • βœ… (Issue) When generating AI Comment, the user’s emotion score sometimes keeps getting saved as 0.
    • I emphasized β€œEspecially do the β€˜5. weighted formula calculation’ accurately. The user’s emotion score is absolutely not 0.” and cases where it writes 0 decreased. (Not gone completely.)
    • Let us move on for now.
  • βœ… (Issue) ChatPage: the character does not know information about itself!
    • Seems to have fixed itself while resolving save-related issues. Nice.
  • βœ… (Issue) ChatPage: the character is ignoring the β€œfollow-up question list”!
    • Seems to have fixed itself while resolving save-related issues. Nice.
  • βœ… (Issue) bottom navigation bar disappears when moving to ChatPage.
    • Always Show Nav bar Toggle On
  • βœ… (Issue) Character image is displayed differently in ChatPage Drawer.
    • This happened because I wrote the AI Comment saving logic wrong before. It only happens in old chats, so resolved by deleting that Chat document.

πŸ’― Summary of what I did

  • Improved Chat creation logic
    • Reviewed parameter structure for systemPromptTemplate and getAIComment
    • Applied system prompt in Create New Chat and optimized OpenAI API Call
    • Organized the Diary-based New Chat creation process: AI comment -> diary summary -> Chat creation
  • Optimized AI comment system
    • Fixed issue where emotion score was saved as 0
    • Resolved issue where AI could not recognize character information
    • Improved issue where follow-up question list was ignored
  • Issue resolution and performance improvement
    • Fixed navigation bar disappearing when moving to ChatPage
    • Fixed character image mismatch by modifying AI Comment save logic
    • Used Document -> Document Reference to prevent Unexpected Null Value

🎯 Future tasks

Click to see details
  • ❔ (Issue) DiaryPage: if the AI Comment answer has not been received, it moves on with the character unset.
    • For now, patch by showing an alert: You must receive a Comment from AI before starting chat!
  • ❔ (Issue) DiaryPage: use markdown viewer for AI Comment response (prevent overflow: Container Height)

  • ❔ ChatPage: align user conversation output to the right

  • ❔ DiaryPage: change face expression Emoji and color according to Mood Slider value

  • ❔ DiaryPage: Go to Linked Chat
  • ❔ ChatPage: Go to Linked Diary
    • When saving from DiaryPage’s Diary Document, also add Chat Reference value as a Diary Document DB field. (linkedChat)
    • In ChatPage’s Chat Document, naturally also add Diary Reference value as a Chat Document DB field. (linkedDiary)
  • ❔ ChatPage - Create New Diary: create a New Diary based on conversation content (use Go to Linked Diary logic)
    • ❔ OpenAI API Call (createChatSummary)
      • Input: Chat Content, System Prompt (Diary From Chat)
      • Output: Chat Summary
    • ❔ OpenAI API Call (createDiaryFromChat)
      • Input: Chat Summary, System Prompt (Diary From Chat)
      • Output: New Diary (Title, Content, Mood score)
  • ❔ MoodPage (top) - Mood Calendar
    • ❔ Check the number of posts written by date
    • ❔ Move to the selected date when clicking a date
  • ❔ MoodPage (bottom) - Mood stats
    • ❔ Output statistics for the focused month
      • ❔ Output AI comment on the displayed statistics
  • ❔ HomeFeedPage - import and apply flutter_slidable:4.0.0
  • ❔ HomeFeedPage: on left/right slide from FeedCardDiary, chat/edit/delete

  • ❔ Chat/Diary: GPT Streaming API

  • ❔ ChatPage - implement AI first message (Alarm/Notification)
    • The core of the chat system prompt is proactivity.
      • To make it more realistic, it might be good to pass create_date of diary/chat too, so the AI can mention dates like β€œyesterday.”
    • Alarm implementation reference
  • ❔ DiaryPage: add detailed emotion keyword Choice Chips and set DB integration
  • ❔ DiaryPage - AI Comment: change inputs such as Choice chips and mood slider to fit the AI Comment System Prompt.
    • ❔ **previous diary or entire conversation history (patchy technical debt)
    • ❔ basic user information: name, gender, MBTI, …
    • ❔ detailed emotion keywords: happy, sad, …
    • ❔ character settings: Somi, Sena, Minhyuk
    • ❔ emotion score: 1 to 100
    • ❔ response format: Healing, Suggestion, Informative
    • ❔ response length: short, normal, detailed
    • is New Chat
      • Since this Chat’s messages are being created for the first time, set is_initial = true on the first message document and shove in all system prompts.
        • is_initial = false
        • Limit: if I put the system prompt into the very first message document, it is hard to modify in the middle of a conversation, but possible. If there is an is_initial = true document and it was modified, I can delete that document and put it back in. I do not know how, but still.
  • ❔ DiaryPage - AI Comment: complete CRUD
    • ❔ remove tmp_ai_comment field and use doc_ref
  • ❔ DiaryPage - Drawer - ChatHistoryListTile: order by updated_time

  • ❔ DiaryPage - import and apply Interactive Slider

  • ❔ HomeFeedPage: implement Search Diary feature

  • ❔ AuthPage: implement Google Login

  • ❔ HomeFeedPage - Bottom Sheet (+ Button): make it possible to choose one of several options
    • New diary: Go to DiaryPage
    • Emotion record: Go to MoodPage
  • ❔ MoodPage (popup): Mood setting slider CRUD
    • Create
    • Read
    • Update
    • Delete
  • ❔ HomeFeedPage - ListView - show FeedCardMood
  • ❔ HomeFeedPage - ListView: sort FeedCardDiary, FeedCardMood, FeedCardChat components chronologically (using Cloud Function)

  • ❔ Create MoodEditPage between HomeFeedPage and DiaryPage: move MoodSlider, MoodKeywordsRate (5~1), MoodDescription widgets, etc.

  • ❔ (Issue) tmpGetAIComment does not consider the emotion keywords selected by the user when creating.

  • ❔ Extract and install the final presentation APK by Wed 2025.2.5

πŸ’­ Diary

Minhyuk

Issues exploded one after another and my mind almost went distant… Is my strategy of β€œeven if technical debt piles up, if I implement first, my skill will keep growing and I can pay off the debt later!” hitting its limit… or was it still an efficient judgment…

Whatever, I do not know~ That is not what matters right now. There is seriously no time! Patchwork go go.

✨ GPT-4o Comment (KPT)

GPT-4o

βœ… What Went Well (Keep)

  1. πŸ›  Organized Chat creation logic: It was good that you organized and resolved various issues occurring during New Chat creation!
  2. 🎭 Improved AI comment system: It was impressive that you fixed emotion score and character setting errors and guided more accurate AI responses.
  3. πŸ” Improved debugging ability: Resolving Unexpected Null Value and learning how to use Document Reference will help a lot going forward.

❌ What Was Missing (Problem)

  1. ⏳ Lots of time spent resolving issues: Debugging took longer than expected, so there may have been less time for the feature development originally targeted.
  2. πŸ”„ Increasing technical debt: The fast implementation strategy is accumulating technical debt, so follow-up cleanup will be needed.
  3. πŸ“‹ Insufficient documentation: If you organize major problem-resolution processes a little more, similar issues can be solved quickly when they happen again.

πŸ”„ What to Try (Try)

  1. πŸ“Œ Analyze issue patterns: Identify repeatedly occurring problems and think about improving the development pattern.
  2. πŸ“ Set a technical debt management strategy: Short-term fast fixes are necessary, but long-term maintenance and optimization need a roadmap.
  3. πŸ“– Build a habit of problem-solving records: Document major issue-resolution processes to save future development time.

🏁 Conclusion

Today was a day where you improved Chat creation logic and fixed AI comment system errors, raising stability. Debugging took longer than expected, but you learned a lot in the process too! Going forward, think about a more efficient development strategy while managing technical debt. πŸš€πŸ”₯

Leave a comment