Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Ai chat context #6929

Merged
merged 10 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

env:
CARGO_TERM_COLOR: always
CLOUD_VERSION: 0.7.6-amd64
CLOUD_VERSION: 0.8.3-amd64
RUST_TOOLCHAIN: "1.80.1"

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ class ChatFile extends Equatable {
final fileName = path.basename(filePath);
final extension = path.extension(filePath).toLowerCase();

ChatMessageMetaTypePB fileType;
ContextLoaderTypePB fileType;
switch (extension) {
case '.pdf':
fileType = ChatMessageMetaTypePB.PDF;
fileType = ContextLoaderTypePB.PDF;
break;
case '.txt':
fileType = ChatMessageMetaTypePB.Txt;
fileType = ContextLoaderTypePB.Txt;
break;
case '.md':
fileType = ChatMessageMetaTypePB.Markdown;
fileType = ContextLoaderTypePB.Markdown;
break;
default:
fileType = ChatMessageMetaTypePB.UnknownMetaType;
fileType = ContextLoaderTypePB.UnknownLoaderType;
}

return ChatFile(
Expand All @@ -101,7 +101,7 @@ class ChatFile extends Equatable {

final String filePath;
final String fileName;
final ChatMessageMetaTypePB fileType;
final ContextLoaderTypePB fileType;

@override
List<Object?> get props => [filePath];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Future<List<ChatMessageMetaPB>> metadataPBFromMetadata(
id: value.id,
name: value.name,
data: pb.text,
dataType: ChatMessageMetaTypePB.Txt,
loaderType: ContextLoaderTypePB.Txt,
source: appflowySource,
),
);
Expand All @@ -156,7 +156,7 @@ Future<List<ChatMessageMetaPB>> metadataPBFromMetadata(
id: nanoid(8),
name: fileName,
data: filePath,
dataType: fileType,
loaderType: fileType,
source: filePath,
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class ImportPayload {
class ImportBackendService {
static Future<FlowyResult<RepeatedViewPB, FlowyError>> importPages(
String parentViewId,
List<ImportValuePayloadPB> values,
List<ImportItemPayloadPB> values,
) async {
final request = ImportPayloadPB(
parentViewId: parentViewId,
values: values,
items: values,
);

return FolderEventImportData(request).send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class _ImportPanelState extends State<ImportPanel> {

showLoading.value = true;

final importValues = <ImportValuePayloadPB>[];
final importValues = <ImportItemPayloadPB>[];
for (final file in result.files) {
final path = file.path;
if (path == null) {
Expand All @@ -163,7 +163,7 @@ class _ImportPanelState extends State<ImportPanel> {
case ImportType.historyDatabase:
final data = await File(path).readAsString();
importValues.add(
ImportValuePayloadPB.create()
ImportItemPayloadPB.create()
..name = name
..data = utf8.encode(data)
..viewLayout = ViewLayoutPB.Grid
Expand All @@ -176,7 +176,7 @@ class _ImportPanelState extends State<ImportPanel> {
final bytes = _documentDataFrom(importType, data);
if (bytes != null) {
importValues.add(
ImportValuePayloadPB.create()
ImportItemPayloadPB.create()
..name = name
..data = bytes
..viewLayout = ViewLayoutPB.Document
Expand All @@ -187,7 +187,7 @@ class _ImportPanelState extends State<ImportPanel> {
case ImportType.csv:
final data = await File(path).readAsString();
importValues.add(
ImportValuePayloadPB.create()
ImportItemPayloadPB.create()
..name = name
..data = utf8.encode(data)
..viewLayout = ViewLayoutPB.Grid
Expand All @@ -197,7 +197,7 @@ class _ImportPanelState extends State<ImportPanel> {
case ImportType.afDatabase:
final data = await File(path).readAsString();
importValues.add(
ImportValuePayloadPB.create()
ImportItemPayloadPB.create()
..name = name
..data = utf8.encode(data)
..viewLayout = ViewLayoutPB.Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AppFlowyGridTest {
final context = await ImportBackendService.importPages(
workspace.id,
[
ImportValuePayloadPB()
ImportItemPayloadPB()
..name = fileName
..data = utf8.encode(data)
..viewLayout = ViewLayoutPB.Grid
Expand Down
17 changes: 9 additions & 8 deletions frontend/appflowy_tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions frontend/appflowy_tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }

# Working directory: frontend
# To update the commit ID, run:
Expand Down
17 changes: 9 additions & 8 deletions frontend/appflowy_web_app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions frontend/appflowy_web_app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "35181c77b448d2ac9cbfbd729790bd98c5d1a979" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "79bc18e4651c17c83d9f00a5ce79423398e88ea1" }


# Working directory: frontend
Expand Down
Loading
Loading