Skip to content

Commit

Permalink
replace mocked data
Browse files Browse the repository at this point in the history
  • Loading branch information
apaladiychuk committed May 13, 2024
1 parent d5117c9 commit 0284dd2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
9 changes: 5 additions & 4 deletions backend/core/bll/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ func (b *chatBL) GetSessionByID(ctx context.Context, user *model.User, id int64)
docs := make([]model.DocumentResponse, 0)
for i := 0; i < 4; i++ {
docs = append(docs, model.DocumentResponse{
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
UpdatedDate: time.Now().UTC().Add(-48 * time.Hour),
})
}
for _, msg := range result.Messages {
Expand Down
11 changes: 6 additions & 5 deletions backend/core/model/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ type Document struct {
}

type DocumentResponse struct {
ID decimal.Decimal `json:"id,omitempty"`
MessageID decimal.Decimal `json:"message_id,omitempty"`
Link string `json:"link,omitempty"`
DocumentID string `json:"document_id,omitempty"`
Content string `json:"content,omitempty"`
ID decimal.Decimal `json:"id,omitempty"`
MessageID decimal.Decimal `json:"message_id,omitempty"`
Link string `json:"link,omitempty"`
DocumentID string `json:"document_id,omitempty"`
Content string `json:"content,omitempty"`
UpdatedDate time.Time `json:"updated_date,omitempty"`
}
type DocumentFeedback struct {
tableName struct{} `pg:"document_feedbacks"`
Expand Down
11 changes: 6 additions & 5 deletions backend/core/responder/ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ func (r *aiResponder) Send(ctx context.Context, ch chan *Response, wg *sync.Wait
Type: ResponseDocument,
Message: nil,
Document: &model.DocumentResponse{
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
MessageID: message.ID,
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
UpdatedDate: time.Now().UTC().Add(-48 * time.Hour),
MessageID: message.ID,
},
}
}
Expand Down
12 changes: 7 additions & 5 deletions backend/core/responder/embedding.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"github.com/shopspring/decimal"
"sync"
"time"
)

type embedding struct {
Expand All @@ -19,11 +20,12 @@ func (r *embedding) Send(ctx context.Context, ch chan *Response, wg *sync.WaitGr
Type: ResponseDocument,
Message: nil,
Document: &model.DocumentResponse{
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
MessageID: parentMessage.ID,
ID: decimal.NewFromInt(int64(i)),
DocumentID: "11",
Link: fmt.Sprintf("link for document %d", i),
Content: fmt.Sprintf("content of document %d", i),
UpdatedDate: time.Now().UTC().Add(-48 * time.Hour),
MessageID: parentMessage.ID,
},
}
}
Expand Down

0 comments on commit 0284dd2

Please sign in to comment.