-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
177 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,4 +168,5 @@ __pycache__ | |
# claude | ||
claude.sync | ||
config.json | ||
claudesync.log | ||
claudesync.log | ||
chats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"uuid": "57506f44-16c7-4a0d-aac8-43f4f770c6e7", | ||
"name": "", | ||
"summary": "", | ||
"model": null, | ||
"created_at": "2024-08-01T12:18:07.059322+00:00", | ||
"updated_at": "2024-08-01T12:18:07.059322+00:00", | ||
"settings": { | ||
"preview_feature_uses_artifacts": true, | ||
"preview_feature_uses_latex": null, | ||
"preview_feature_uses_citations": null | ||
}, | ||
"is_starred": false, | ||
"project_uuid": "5bdc9859-67b1-4024-ae16-67b7375097f5", | ||
"current_leaf_message_uuid": null, | ||
"project": { | ||
"uuid": "5bdc9859-67b1-4024-ae16-67b7375097f5", | ||
"name": "claudesync" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import textwrap | ||
import unittest | ||
|
||
from claudesync.chat_sync import extract_artifacts | ||
|
||
|
||
class TestExtractArtifacts(unittest.TestCase): | ||
|
||
def test_extract_single_artifact(self): | ||
text = """ | ||
Here is some introductory text. | ||
<antArtifact identifier="test-id" type="text/html" title="Test Title"> | ||
<html> | ||
<head><title>Test</title></head> | ||
<body>Test Content</body> | ||
</html> | ||
</antArtifact> | ||
Some concluding text. | ||
""" | ||
expected_result = [ | ||
{ | ||
"identifier": "test-id", | ||
"type": "text/html", | ||
"content": "<html>\n<head><title>Test</title></head>\n<body>Test Content</body>\n</html>", | ||
} | ||
] | ||
self.assertEqual(extract_artifacts(textwrap.dedent(text)), expected_result) | ||
|
||
def test_extract_multiple_artifacts(self): | ||
text = """ | ||
Here is some introductory text. | ||
<antArtifact identifier="first-id" type="text/plain" title="First Title"> | ||
First artifact content. | ||
</antArtifact> | ||
Some middle text. | ||
<antArtifact identifier="second-id" type="text/xml" title="Second Title"> | ||
<note> | ||
<to>User</to> | ||
<from>ChatGPT</from> | ||
<heading>Reminder</heading> | ||
<body>Don't forget to check your email!</body> | ||
</note> | ||
</antArtifact> | ||
Some concluding text. | ||
""" | ||
expected_result = [ | ||
{ | ||
"identifier": "first-id", | ||
"type": "text/plain", | ||
"content": "First artifact content.", | ||
}, | ||
{ | ||
"identifier": "second-id", | ||
"type": "text/xml", | ||
"content": "<note>\n<to>User</to>\n<from>ChatGPT</from>\n<heading>Reminder</heading>\n<body>Don't forget to check your email!</body>\n</note>", | ||
}, | ||
] | ||
self.assertEqual(extract_artifacts(textwrap.dedent(text)), expected_result) | ||
|
||
def test_no_artifacts(self): | ||
text = """ | ||
Here is some text without any artifacts. | ||
""" | ||
expected_result = [] | ||
self.assertEqual(extract_artifacts(text), expected_result) |