Documentation ¶
Index ¶
- Variables
- func Check(e error)
- func CheckEmpty(name string) (bool, error)
- func ConnectDB()
- func Index(c *gin.Context)
- func LoginPage(c *gin.Context)
- func Parsification(c *gin.Context)
- func Suggestion(c *gin.Context)
- func Upload(c *gin.Context)
- type AnalyzeRequest
- type AnalyzeRequestAttr
- type AnalyzeRequestComment
- type AnalyzeResponse
- type AttributeScore
- type ErrorRes
- type Score
- type Scores
- type SpanScore
- type Specialist
- type SuggestRequest
- type SuggestResposne
Constants ¶
This section is empty.
Variables ¶
var DB *gorm.DB
Functions ¶
func CheckEmpty ¶
func Index ¶
=================== Serializers =================== * Home serializer * Login serializer * Score Summary serializer * Parsification/Scoring serializer * Score suggestion serializer
func Parsification ¶
TODO: need to update how failure is handled and logging write method for triggering scores perspective api res loaded into tmp schema.go and saved to db
func Suggestion ¶
FIXME: update once template implemented will be for giving ai model feedback on returned scores so we can consistently enhance our UX.
Types ¶
type AnalyzeRequest ¶
type AnalyzeRequest struct { Comment AnalyzeRequestComment `json:"comment"` ReqAttr map[Attribute]AnalyzeRequestAttr `json:"requestedAttributes"` //Indicates if the request should return spans that describe the scores for each part of the text (currently done at per-sentence level). SpanAnnotations bool `json:"spanAnnotations,omitempty"` //Stored comments will be used for future research DoNotStore bool `json:"doNotStore,omitempty"` //(optional) Example: "en", "es", "fr", "de", etc. If unspecified, the API will auto-detect the comment language. Languages []string `json:"languages,omitempty"` //(optional) An opaque token that is echoed back in the response. (Note: This is not the clientId, which is automatically set through Google Cloud. This is a field users can set to help them keep track of their requests.) ClientToken string `json:"clientToken,omitempty"` //(optional) An opaque session ID. This should be set for authorship experiences by the client side so that groups of requests can be grouped together into a session. SessionID string `json:"sessionId,omitempty"` //(optional) An opaque identifier associating this comment with a particular community within your platform. CommunityID string `json:"communityId,omitempty"` }
FIXME: SuggestRequst is the data for the API's analyze method.
type AnalyzeRequestAttr ¶
type AnalyzeRequestAttr struct { //(optional) Currently, only "PROBABILITY" is supported. ScoreType string `json:"scoreType,omitempty"` //(optional)The API won't return scores that are below this threshold for this attribute. ScoreThreshold float32 `json:"scoreThreshold,omitempty"` }
AnalyzeRequestAttr is a type for AnalyzeRequest struct.
type AnalyzeRequestComment ¶
type AnalyzeRequestComment struct { Text string `json:"text"` //(optional) Type must be either "PLAIN_TEXT" or "HTML". Currently only "PLAIN_TEXT" is supported. Type string `json:"type,omitempty"` }
AnalyzeRequestComment is a type for AnalyzeRequest struct.
type AnalyzeResponse ¶
type AnalyzeResponse struct { //The attribute names will mirror the request's requestedAttributes. AttributeScores map[Attribute]AttributeScore `json:"attributeScores"` //Mirrors the request's languages. If no languages were specified, the API returns the auto-detected language. Languages []string `json:"languages"` Error ErrorRes `json:"error"` }
AnalyzeResponse is the response data from the API's analyze method.
type AttributeScore ¶
type ErrorRes ¶
type ErrorRes struct { Code int `json:"code"` Message string `json:"message"` Status string `json:"status"` Details []map[string]interface{} `json:"details"` }
ErrorRes is the mapped API error response.
type Specialist ¶
type Specialist struct { ID uint `json:"id" gorm:"primary_key"` First_name string `json:"first_name"` Last_name string `json:"last_name"` Email string `json:"email"` }
TODO:
type SuggestRequest ¶
type SuggestRequest struct { Comment AnalyzeRequestComment `json:"comment"` //This holds the attribute scores that the client believes the comment should have. It has the same format as the attributeScores. AttributeScores map[Attribute]AttributeScore `json:"attributeScores"` //(optional) Example: "en", "es", "fr", "de", etc. If unspecified, the API will auto-detect the comment language. Languages []string `json:"languages,omitempty"` //(optional) An opaque identifier associating this comment with a particular community within your platform. CommunityID string `json:"communityId,omitempty"` //(optional) An opaque token that is echoed back in the response. (Note: This is not the clientId, which is automatically set through Google Cloud. This is a field users can set to help them keep track of their requests.) ClientToken string `json:"clientToken,omitempty"` }
SuggestRequst is the data for the API's suggest method.
type SuggestResposne ¶
type SuggestResposne struct { ClientToken string `json:"clientToken"` Error ErrorRes `json:"error"` }
AnalyzeResponse is the response data from the API's suggest method.