mirror of
https://github.com/AppFlowy-IO/AppFlowy-Cloud.git
synced 2025-04-19 03:24:42 -04:00
* chore: create embeddings by paragraphs * chore: use document paragraphs method * chore: document indexing by paragraphs with consistent hash * chore: compare produced embeddings against existing ones * chore: make pg stored proc compare between input and existing embedded fragments * chore: missing sqlx generation * fix: appflowy worker * chore: make sure that embeddings are only changed when content had changed * chore: remove partition key and recreate af_collab_embeddings_upsert migration * chore: use pg15 on CI and update af_collab_embeddings table primary key * chore: fix test --------- Co-authored-by: Nathan <nathan@appflowy.io>
26 lines
2.2 KiB
Rust
26 lines
2.2 KiB
Rust
use collab::core::origin::CollabOrigin;
|
|
use collab::preclude::Collab;
|
|
use collab_document::document::Document;
|
|
use workspace_template::document::getting_started::{
|
|
get_initial_document_data, getting_started_document_data,
|
|
};
|
|
|
|
#[test]
|
|
fn document_plain_text() {
|
|
let doc = getting_started_document_data().unwrap();
|
|
let collab = Collab::new_with_origin(CollabOrigin::Server, "1", vec![], false);
|
|
let document = Document::create_with_data(collab, doc).unwrap();
|
|
let text = document.paragraphs().join("");
|
|
let expected = "Welcome to AppFlowy $ Download for macOS, Windows, and Linux link $ $ $ quick start Ask AI powered by advanced AI models: chat, search, write, and much more ✨ ❤\u{fe0f}Love AppFlowy and open source? Follow our latest product updates: Twitter : @appflowy Reddit : r/appflowy Github ";
|
|
assert_eq!(&text, expected);
|
|
}
|
|
|
|
#[test]
|
|
fn document_plain_text_with_nested_blocks() {
|
|
let doc = get_initial_document_data().unwrap();
|
|
let collab = Collab::new_with_origin(CollabOrigin::Server, "1", vec![], false);
|
|
let document = Document::create_with_data(collab, doc).unwrap();
|
|
let text = document.paragraphs().join("");
|
|
let expected = "Welcome to AppFlowy! Here are the basics Here is H3 Click anywhere and just start typing. Click Enter to create a new line. Highlight any text, and use the editing menu to style your writing however you like. As soon as you type / a menu will pop up. Select different types of content blocks you can add. Type / followed by /bullet or /num to create a list. Click + New Page button at the bottom of your sidebar to add a new page. Click + next to any page title in the sidebar to quickly add a new subpage, Document , Grid , or Kanban Board . Keyboard shortcuts, markdown, and code block Keyboard shortcuts guide Markdown reference Type /code to insert a code block // This is the main function.\nfn main() {\n // Print text to the console.\n println!(\"Hello World!\");\n} This is a paragraph This is a paragraph Have a question❓ Click ? at the bottom right for help and support. This is a paragraph This is a paragraph Click ? at the bottom right for help and support. Like AppFlowy? Follow us: GitHub Twitter : @appflowy Newsletter ";
|
|
assert_eq!(&text, expected);
|
|
}
|