HackMD
    • Sharing Link copied
    • /edit
    • View mode
      • Edit mode
      • View mode
      • Book mode
      • Slide mode
      Edit mode View mode Book mode Slide mode
    • Note Permission
    • Read
      • Owners
      • Signed-in users
      • Everyone
      Owners Signed-in users Everyone
    • Write
      • Owners
      • Signed-in users
      • Everyone
      Owners Signed-in users Everyone
    • More (Comment, Invitee)
    • Publishing
    • Commenting Enable
      Disabled Forbidden Owners Signed-in users Everyone
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Invitee
    • No invitee
    • Options
    • Versions
    • Transfer ownership
    • Delete this note
    • Template
    • Insert from template
    • Export
    • Google Drive Export to Google Drive
    • Gist
    • Import
    • Google Drive Import from Google Drive
    • Gist
    • Clipboard
    • Download
    • Markdown
    • HTML
    • Raw HTML
Menu Sharing Help
Menu
Options
Versions Transfer ownership Delete this note
Export
Google Drive Export to Google Drive Gist
Import
Google Drive Import from Google Drive Gist Clipboard
Download
Markdown HTML Raw HTML
Back
Sharing
Sharing Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
More (Comment, Invitee)
Publishing
More (Comment, Invitee)
Commenting Enable
Disabled Forbidden Owners Signed-in users Everyone
Permission
Owners
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Invitee
No invitee
   owned this note    owned this note      
Published Linked with
Like BookmarkBookmarked
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: cofacts, chatgpt --- # ChatGPT integration Large language models can be helpful to human beings when they encounter internet hoax. :::info This document now only contains implementation detail. Original use cases and related research has been moved to https://g0v.hackmd.io/@cofacts/rd/%2FmU8qi721RZeAQ9PDfj7XRA ::: ## Scenario #1: point out suspicious points For scenario #1 identified in the research document, the ChatGPT response on critical thinking of the forwarded messages are called "AI replies". ### Chatbot When to create AI reply: - Is text message - Text length > 20 (?) - No AI replies yet Can implement a `getOrCreateAiReply(articleId)` helper function for the following scenarios. #### After searching a message that has not been replied yet > https://www.figma.com/proto/1tiXCGut4kNCEkDG9FTza7/LINE-Chat-UI-Template-(Community)?page-id=208%3A844&node-id=302-1236&viewport=294%2C-41%2C0.53&scaling=scale-down - Not clear that this is AI text - 「還沒有人回應唷。在這之前,可以參考以下 ChatGPT 的自動回應。」 - 「在真人回覆前,AI 媒體識讀小幫手 (ChatGPT) 針對這篇訊息有以下看法。」 - ✅ 「這篇文章尚待查核,請先不要相信這篇文章。機器人初步分析此篇文章有下列幾點需要特別留意:」[name=cai] - surrounding text - 「請先不要相信這篇文章唷」will show for images / videos, because they don't have AI response - More call to actions on the quality of this AI generated content? - Thumbs-up / thumbs-down feedback? #### After submitting a new message to database (Note: this does not apply if we decide to only generate AI replies for messages with >=2 reply requests.) > https://www.figma.com/proto/1tiXCGut4kNCEkDG9FTza7/LINE-Chat-UI-Template-(Community)?page-id=208%3A844&node-id=339-1260&viewport=334%2C-393%2C0.53&scaling=scale-down - Last 5 sentences are identical. #### After voting a reply as not useful Nice-to-have ### Site > https://www.figma.com/file/DvmAQjMJCncuPORWKnljM1/Cofacts-LIFF-and-new-designs?node-id=5133-543&t=sml0QRW7fnGr8xfV-4 Display an extra section when all of the below is satisfied: - An AI reply is already generated - No (useful) replies yet Discussion - No replies v.s. no useful replies? - Should we still show the section if there are replies? - Should we show them in collapsed state, like the collapsible contribution graph in user profile page? :::success 2023/3/22 meeting: - Pick left design (differentiate user reply & AI reply) - Always show ChatGPT section - Collapse when have human reply ::: ### Elasticsearch - No need to index / search by text - Need to index by user ID, doc ID, etc. #### New index: `airesponses` - Records all AI responses; not limited to AI replies. - Collect all AI responses in one index to better manage quota. - May support more use cases in the future. - Creates one `aiResponse` doc with `status=LOADING` - In async scenarios (if there is one), users can poll `aiResponses` to get latest update - Updates the doc by providing `text`, `usage`, `resolvedAt`. Fields - `docType`, `docId`: the target of this response. - May be empty for scenario #2 - `text`: AI response - `userId`, `appId`: the user that generated this content - `request`: API request body - No need to index, just for record. - `{type: 'keyword', index: false, doc_values: false}` - `usage`: API response of token usage - `promptTokens`, `completionTokens`, `totalTokens` - `status`: `LOADING` | `SUCCESS` | `ERROR` - `createdAt` - `resolvedAt` #### New index: `airesponsefeedbacks` - `aiResponseId` - `userId`, `appId`: the user giving feedback - `score`: 1, -1 - `comment` - `createdAt`, `updatedAt` - `status`: `NORMAL`, `BLOCKED` ### API #### New `AIResponse` object type Exposes the fields in elasticsearch index `airesponses`. Also: - `feedbacks` - Arg: `statuses` - type: `AIResponseFeedback` - `positiveFeedbackCount` - `negativeFeedbackCount` #### New `AIResponseFeedback` object type Exposes fields in elasticsearch index `airesponsefeedbacks`. #### New mutation `createAIReply` Generates new AI response doc that points to an article. (If we will have other AI responses in the future, use another mutation,) Inputs - `articleId`: `String` - `waitForCompletion`: `Boolean` Output `AIResponse` object. #### New mutation `createOrUpdateAiResponseFeedback` Inputs - `aiResponseId` - `score` - `comment` Outputs `AiResponse` object. #### New query `ListAIResponses` - filter by `docType`, `docId`, `userId`, `appId` , `createdAt`, `resolvedAt`, etc - order by `createdAt`, `resolvedAt` #### New query `ListAIResponseFeedbacks` - filter by `docType`, `docId`, `userId`, `appId` , `createdAt`, `resolvedAt`, etc - order by `createdAt`, `resolvedAt` #### `Article` object type - New field `aiReplies` - type: `AIResponse` ## Roadmap ### Phase 0: preparation - [x] Elasticsearch: `airesponses` - [x] API: `createAIReply`, `AIResponse`, `ListAIResponses`, `Article` object type - [x] Deploy API with openai token ### Phase 1: AI reply - [x] Chatbot: `getOrCreateAiReply(articleId)`, no-reply-yet scenario - [x] Website: display the AI reply ### Phase 2: Feedbacks for the AI reply - [ ] Elasticsearch: `airesponsefeedbacks` - [ ] API: `ListAIResponseFeedbacks`, `AIResponseFeedback` - [ ] Chatbot: Feedback card, feedback LIFF - [ ] Website: feedback buttons ## Scenario #1 extended: Provide search keywords :::warning Priority: As discussed on 2023/4/12, we will implement keyword first, then feedbacks for AI reply. - Evaluation can come later, get BETA version of keywords first [name=bil] ::: chatbot: https://www.figma.com/proto/1tiXCGut4kNCEkDG9FTza7/LINE-Chat-UI-Template-(Community)?node-id=302-1236&scaling=scale-down&page-id=208%3A844 website: https://www.figma.com/file/DvmAQjMJCncuPORWKnljM1/Cofacts-LIFF-and-new-designs?node-id=5163-546&t=nHTu1xJbgYP5rEao-4

Import from clipboard

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lost their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.


Upgrade

All
  • All
  • Team
No template.

Create a template


Upgrade

Delete template

Do you really want to delete this template?

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

Sign in via GitHub

New to HackMD? Sign up

Help

  • English
  • 中文
  • 日本語

Documents

Tutorials

Book Mode Tutorial

Slide Example

YAML Metadata

Resources

Releases

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions

Versions

Upgrade now

Version named by    

More Less
  • Edit
  • Delete

Note content is identical to the latest version.
Compare with
    Choose a version
    No search result
    Version not found

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.