@talesofai/neta-skills 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +234 -0
  4. package/README.md +237 -0
  5. package/bin/apis/activity.js +14 -0
  6. package/bin/apis/artifact.js +64 -0
  7. package/bin/apis/audio.js +10 -0
  8. package/bin/apis/collection.js +87 -0
  9. package/bin/apis/config.js +49 -0
  10. package/bin/apis/feeds.js +34 -0
  11. package/bin/apis/gpt.js +10 -0
  12. package/bin/apis/hashtag.js +23 -0
  13. package/bin/apis/index.js +62 -0
  14. package/bin/apis/prompt.js +120 -0
  15. package/bin/apis/recsys.js +29 -0
  16. package/bin/apis/space.js +48 -0
  17. package/bin/apis/task.js +21 -0
  18. package/bin/apis/tcp.js +16 -0
  19. package/bin/apis/types.js +76 -0
  20. package/bin/apis/user.js +45 -0
  21. package/bin/apis/verse.js +18 -0
  22. package/bin/cli.js +16 -0
  23. package/bin/commands/community/create_comment.cmd.en_us.yml +4 -0
  24. package/bin/commands/community/create_comment.cmd.js +40 -0
  25. package/bin/commands/community/create_comment.cmd.zh_cn.yml +3 -0
  26. package/bin/commands/community/favor_collection.cmd.en_us.yml +4 -0
  27. package/bin/commands/community/favor_collection.cmd.js +29 -0
  28. package/bin/commands/community/favor_collection.cmd.zh_cn.yml +3 -0
  29. package/bin/commands/community/get_fan_list.cmd.en_us.yml +4 -0
  30. package/bin/commands/community/get_fan_list.cmd.js +36 -0
  31. package/bin/commands/community/get_fan_list.cmd.zh_cn.yml +3 -0
  32. package/bin/commands/community/get_hashtag_characters.cmd.en_us.yml +4 -0
  33. package/bin/commands/community/get_hashtag_characters.cmd.js +46 -0
  34. package/bin/commands/community/get_hashtag_characters.cmd.zh_cn.yml +3 -0
  35. package/bin/commands/community/get_hashtag_collections.cmd.en_us.yml +6 -0
  36. package/bin/commands/community/get_hashtag_collections.cmd.js +54 -0
  37. package/bin/commands/community/get_hashtag_collections.cmd.zh_cn.yml +5 -0
  38. package/bin/commands/community/get_hashtag_info.cmd.en_us.yml +4 -0
  39. package/bin/commands/community/get_hashtag_info.cmd.js +42 -0
  40. package/bin/commands/community/get_hashtag_info.cmd.zh_cn.yml +3 -0
  41. package/bin/commands/community/get_subscribe_list.cmd.en_us.yml +4 -0
  42. package/bin/commands/community/get_subscribe_list.cmd.js +36 -0
  43. package/bin/commands/community/get_subscribe_list.cmd.zh_cn.yml +3 -0
  44. package/bin/commands/community/like_collection.cmd.en_us.yml +4 -0
  45. package/bin/commands/community/like_collection.cmd.js +29 -0
  46. package/bin/commands/community/like_collection.cmd.zh_cn.yml +4 -0
  47. package/bin/commands/community/list_space_topics.cmd.en_us.yml +7 -0
  48. package/bin/commands/community/list_space_topics.cmd.js +39 -0
  49. package/bin/commands/community/list_space_topics.cmd.zh_cn.yml +6 -0
  50. package/bin/commands/community/list_spaces.cmd.en_us.yml +4 -0
  51. package/bin/commands/community/list_spaces.cmd.js +19 -0
  52. package/bin/commands/community/list_spaces.cmd.zh_cn.yml +3 -0
  53. package/bin/commands/community/read_collection.cmd.en_us.yml +4 -0
  54. package/bin/commands/community/read_collection.cmd.js +83 -0
  55. package/bin/commands/community/read_collection.cmd.zh_cn.yml +3 -0
  56. package/bin/commands/community/request_interactive_feed.cmd.en_us.yml +4 -0
  57. package/bin/commands/community/request_interactive_feed.cmd.js +54 -0
  58. package/bin/commands/community/request_interactive_feed.cmd.zh_cn.yml +5 -0
  59. package/bin/commands/community/subscribe_user.cmd.en_us.yml +4 -0
  60. package/bin/commands/community/subscribe_user.cmd.js +33 -0
  61. package/bin/commands/community/subscribe_user.cmd.zh_cn.yml +3 -0
  62. package/bin/commands/community/suggest_categories.cmd.en_us.yml +4 -0
  63. package/bin/commands/community/suggest_categories.cmd.js +26 -0
  64. package/bin/commands/community/suggest_categories.cmd.zh_cn.yml +3 -0
  65. package/bin/commands/community/suggest_content.cmd.en_us.yml +5 -0
  66. package/bin/commands/community/suggest_content.cmd.js +59 -0
  67. package/bin/commands/community/suggest_content.cmd.zh_cn.yml +4 -0
  68. package/bin/commands/community/suggest_keywords.cmd.en_us.yml +4 -0
  69. package/bin/commands/community/suggest_keywords.cmd.js +26 -0
  70. package/bin/commands/community/suggest_keywords.cmd.zh_cn.yml +3 -0
  71. package/bin/commands/community/suggest_tags.cmd.en_us.yml +4 -0
  72. package/bin/commands/community/suggest_tags.cmd.js +26 -0
  73. package/bin/commands/community/suggest_tags.cmd.zh_cn.yml +3 -0
  74. package/bin/commands/community/validate_tax_path.cmd.en_us.yml +4 -0
  75. package/bin/commands/community/validate_tax_path.cmd.js +24 -0
  76. package/bin/commands/community/validate_tax_path.cmd.zh_cn.yml +3 -0
  77. package/bin/commands/creative/edit_colleciton.cmd.en_us.yml +11 -0
  78. package/bin/commands/creative/edit_colleciton.cmd.js +140 -0
  79. package/bin/commands/creative/edit_colleciton.cmd.zh_cn.yml +10 -0
  80. package/bin/commands/creative/make_image.cmd.en_us.yml +20 -0
  81. package/bin/commands/creative/make_image.cmd.js +58 -0
  82. package/bin/commands/creative/make_image.cmd.zh_cn.yml +19 -0
  83. package/bin/commands/creative/make_song.cmd.en_us.yml +8 -0
  84. package/bin/commands/creative/make_song.cmd.js +53 -0
  85. package/bin/commands/creative/make_song.cmd.zh_cn.yml +7 -0
  86. package/bin/commands/creative/make_video.cmd.en_us.yml +17 -0
  87. package/bin/commands/creative/make_video.cmd.js +54 -0
  88. package/bin/commands/creative/make_video.cmd.zh_cn.yml +16 -0
  89. package/bin/commands/creative/publish_collection.cmd.en_us.yml +10 -0
  90. package/bin/commands/creative/publish_collection.cmd.js +101 -0
  91. package/bin/commands/creative/publish_collection.cmd.zh_cn.yml +9 -0
  92. package/bin/commands/creative/remove_background.cmd.en_us.yml +10 -0
  93. package/bin/commands/creative/remove_background.cmd.js +74 -0
  94. package/bin/commands/creative/remove_background.cmd.zh_cn.yml +9 -0
  95. package/bin/commands/creative/request_character_or_elementum.cmd.en_us.yml +23 -0
  96. package/bin/commands/creative/request_character_or_elementum.cmd.js +108 -0
  97. package/bin/commands/creative/request_character_or_elementum.cmd.zh_cn.yml +22 -0
  98. package/bin/commands/creative/search_tcp.cmd.en_us.yml +16 -0
  99. package/bin/commands/creative/search_tcp.cmd.js +53 -0
  100. package/bin/commands/creative/search_tcp.cmd.zh_cn.yml +15 -0
  101. package/bin/commands/factory.js +15 -0
  102. package/bin/commands/load.js +157 -0
  103. package/bin/utils/errors.js +61 -0
  104. package/bin/utils/json.js +8 -0
  105. package/bin/utils/lang.js +8 -0
  106. package/bin/utils/parse_meta.js +16 -0
  107. package/bin/utils/polling.js +17 -0
  108. package/bin/utils/prompts.js +186 -0
  109. package/package.json +77 -0
  110. package/skills/neta/SKILL.md +119 -0
  111. package/skills/neta-community/SKILL.md +123 -0
  112. package/skills/neta-creative/SKILL.md +118 -0
  113. package/skills/neta-space/SKILL.md +129 -0
  114. package/skills/neta-suggest/SKILL.md +490 -0
  115. package/skills/zh_cn/neta/SKILL.md +111 -0
  116. package/skills/zh_cn/neta/references/character-search.md +234 -0
  117. package/skills/zh_cn/neta/references/collection-remix.md +40 -0
  118. package/skills/zh_cn/neta/references/community-exploration.md +636 -0
  119. package/skills/zh_cn/neta/references/hashtag-research.md +295 -0
  120. package/skills/zh_cn/neta/references/image-generation.md +121 -0
  121. package/skills/zh_cn/neta/references/interactive-feed.md +377 -0
  122. package/skills/zh_cn/neta/references/social-interactive.md +73 -0
  123. package/skills/zh_cn/neta/references/song-creation.md +247 -0
  124. package/skills/zh_cn/neta/references/song-mv.md +198 -0
  125. package/skills/zh_cn/neta/references/space.md +90 -0
  126. package/skills/zh_cn/neta/references/video-generation.md +221 -0
  127. package/skills/zh_cn/neta-community/SKILL.md +109 -0
  128. package/skills/zh_cn/neta-community/references/character-search.md +233 -0
  129. package/skills/zh_cn/neta-community/references/hashtag-research.md +295 -0
  130. package/skills/zh_cn/neta-community/references/interactive-feed.md +377 -0
  131. package/skills/zh_cn/neta-community/references/social-interactive.md +73 -0
  132. package/skills/zh_cn/neta-creative/SKILL.md +105 -0
  133. package/skills/zh_cn/neta-creative/references/character-search.md +233 -0
  134. package/skills/zh_cn/neta-creative/references/collection-remix.md +40 -0
  135. package/skills/zh_cn/neta-creative/references/image-generation.md +121 -0
  136. package/skills/zh_cn/neta-creative/references/song-creation.md +247 -0
  137. package/skills/zh_cn/neta-creative/references/song-mv.md +198 -0
  138. package/skills/zh_cn/neta-creative/references/video-generation.md +221 -0
  139. package/skills/zh_cn/neta-space/SKILL.md +126 -0
  140. package/skills/zh_cn/neta-suggest/SKILL.md +662 -0
@@ -0,0 +1,87 @@
1
+ import qs from "qs";
2
+ export const isVerseCTA = (cta_info) => {
3
+ return "interactive_config" in cta_info;
4
+ };
5
+ export const createCollectionApis = (client) => {
6
+ const createCollection = async () => {
7
+ return client
8
+ .get("/v1/story/new-story")
9
+ .then((res) => res.data.data.uuid);
10
+ };
11
+ const saveCollection = async (payload) => {
12
+ return await client
13
+ .put("/v3/story/story", payload)
14
+ .then((res) => res.data);
15
+ };
16
+ const publishCollection = async (uuid, options) => {
17
+ const { triggerTCPCommentNow, triggerSameStyleReply, sync_mode } = options ?? {};
18
+ return client
19
+ .put(`/v1/story/story-publish?${qs.stringify({
20
+ storyId: uuid,
21
+ triggerTCPCommentNow: triggerTCPCommentNow ?? false,
22
+ triggerSameStyleReply: triggerSameStyleReply ?? false,
23
+ sync_mode: sync_mode ?? false,
24
+ })}`)
25
+ .then((res) => res.data.status === "SUCCESS");
26
+ };
27
+ const collectionDetails = async (uuids) => {
28
+ return client
29
+ .get("/v3/story/story-detail", {
30
+ params: {
31
+ uuids: uuids.join(","),
32
+ },
33
+ })
34
+ .then((res) => res.data);
35
+ };
36
+ const likeCollection = async (storyId, options) => {
37
+ const { is_cancel } = options ?? {};
38
+ const response = await client.request({
39
+ method: "PUT",
40
+ url: "/v1/story/story-like",
41
+ data: {
42
+ storyId,
43
+ is_cancel: is_cancel ?? false,
44
+ },
45
+ });
46
+ return response.status === 200 || response.status === 204;
47
+ };
48
+ const createComment = async (params) => {
49
+ const response = await client.request({
50
+ method: "POST",
51
+ url: "/v1/comment/comment",
52
+ data: {
53
+ content: params.content,
54
+ parent_uuid: params.parent_uuid,
55
+ parent_type: params.parent_type,
56
+ at_users: params.at_users ?? [],
57
+ },
58
+ });
59
+ return {
60
+ success: response.status === 200 || response.status === 201,
61
+ comment: response.data,
62
+ };
63
+ };
64
+ const favorCollection = async (storyId, options) => {
65
+ const { is_cancel } = options ?? {};
66
+ const response = await client.request({
67
+ method: "PUT",
68
+ url: "/v1/story/story-favor",
69
+ data: {
70
+ storyId,
71
+ is_cancel: is_cancel ?? false,
72
+ },
73
+ });
74
+ return {
75
+ success: response.status === 200 || response.status === 204,
76
+ };
77
+ };
78
+ return {
79
+ createCollection,
80
+ saveCollection,
81
+ publishCollection,
82
+ collectionDetails,
83
+ likeCollection,
84
+ createComment,
85
+ favorCollection,
86
+ };
87
+ };
@@ -0,0 +1,49 @@
1
+ import { safeParseJson } from "../utils/json.js";
2
+ export function createConfigApis(client) {
3
+ const getConfig = async (namespace, key) => {
4
+ const res = await client
5
+ .get(`/v1/configs/config`, {
6
+ params: {
7
+ namespace,
8
+ key,
9
+ },
10
+ })
11
+ .then((res) => res.data);
12
+ if (!res)
13
+ return null;
14
+ switch (res.type) {
15
+ case "string": {
16
+ const value = String(res.value);
17
+ if (value === "null") {
18
+ return null;
19
+ }
20
+ else {
21
+ return value;
22
+ }
23
+ }
24
+ case "int": {
25
+ const value = Number(res.value);
26
+ if (Number.isNaN(value)) {
27
+ return null;
28
+ }
29
+ else {
30
+ return value;
31
+ }
32
+ }
33
+ case "json": {
34
+ const value = safeParseJson(res.value);
35
+ if (value === null) {
36
+ return null;
37
+ }
38
+ else {
39
+ return value;
40
+ }
41
+ }
42
+ default:
43
+ return null;
44
+ }
45
+ };
46
+ return {
47
+ getConfig,
48
+ };
49
+ }
@@ -0,0 +1,34 @@
1
+ export const createFeedsApis = (client) => {
2
+ const homeList = (params) => {
3
+ return client.get("/v1/home/feed/mainlist", {
4
+ params,
5
+ });
6
+ };
7
+ const interactiveItem = async (params) => {
8
+ return client
9
+ .get("/v1/home/feed/interactive", {
10
+ params: {
11
+ collection_uuid: params.collection_uuid,
12
+ page_index: 0,
13
+ page_size: 1,
14
+ },
15
+ })
16
+ .then((res) => res.data.module_list[0]);
17
+ };
18
+ const interactiveList = async (params) => {
19
+ return client
20
+ .get("/v1/recsys/feed/interactive", {
21
+ params,
22
+ })
23
+ .then((res) => res.data);
24
+ };
25
+ const tags = (uuid) => client
26
+ .get(`/v1/home/collection/${uuid}/tags`)
27
+ .then((res) => res.data);
28
+ return {
29
+ homeList,
30
+ interactiveList,
31
+ interactiveItem,
32
+ tags,
33
+ };
34
+ };
@@ -0,0 +1,10 @@
1
+ export const createGptApis = (client) => {
2
+ const messages = async (uuid) => {
3
+ return client
4
+ .get(`/v3/gpt/message/${uuid}`)
5
+ .then((res) => res.data);
6
+ };
7
+ return {
8
+ messages,
9
+ };
10
+ };
@@ -0,0 +1,23 @@
1
+ export const createHashtagApis = (client) => {
2
+ const createHashtag = (name, fromHashtag) => client
3
+ .post("/v1/hashtag/", { name, base_hashtag: fromHashtag })
4
+ .then((res) => res.data);
5
+ const fetchHashtag = async (hashtag, config) => {
6
+ const url = `/v1/hashtag/hashtag_info/${encodeURIComponent(hashtag)}`;
7
+ return client.get(url, config).then((res) => res.data);
8
+ };
9
+ const fetchCharactersByHashtag = async (hashtag, params, config) => {
10
+ const url = `/v1/hashtag/${encodeURIComponent(hashtag)}/tcp-list`;
11
+ return client
12
+ .get(url, {
13
+ ...config,
14
+ params,
15
+ })
16
+ .then((res) => res.data);
17
+ };
18
+ return {
19
+ createHashtag,
20
+ fetchHashtag,
21
+ fetchCharactersByHashtag,
22
+ };
23
+ };
@@ -0,0 +1,62 @@
1
+ import axios from "axios";
2
+ import { handleAxiosError } from "../utils/errors.js";
3
+ import { createActivityApis } from "./activity.js";
4
+ import { createArtifactApis } from "./artifact.js";
5
+ import { createAudioApis } from "./audio.js";
6
+ import { createCollectionApis } from "./collection.js";
7
+ import { createConfigApis } from "./config.js";
8
+ import { createFeedsApis } from "./feeds.js";
9
+ import { createGptApis } from "./gpt.js";
10
+ import { createHashtagApis, } from "./hashtag.js";
11
+ import { createPromptApis } from "./prompt.js";
12
+ import { createRecsysApis } from "./recsys.js";
13
+ import { createSpaceApis } from "./space.js";
14
+ import { createTaskApis } from "./task.js";
15
+ import { createTcpApis } from "./tcp.js";
16
+ import { createUserApis } from "./user.js";
17
+ import { createVerseApis } from "./verse.js";
18
+ export const createApis = (option) => {
19
+ const baseUrl = option.baseUrl;
20
+ const client = axios.create({
21
+ adapter: "fetch",
22
+ baseURL: baseUrl,
23
+ headers: {
24
+ ...option.headers,
25
+ },
26
+ });
27
+ client.interceptors.response.use((response) => response, (error) => {
28
+ handleAxiosError(error);
29
+ });
30
+ const tcp = createTcpApis(client);
31
+ const artifact = createArtifactApis(client);
32
+ const prompt = createPromptApis(client, tcp, artifact);
33
+ const gpt = createGptApis(client);
34
+ const audio = createAudioApis(client);
35
+ const hashtag = createHashtagApis(client);
36
+ const activity = createActivityApis(client);
37
+ const verse = createVerseApis(client);
38
+ const task = createTaskApis(client);
39
+ const config = createConfigApis(client);
40
+ const user = createUserApis(client);
41
+ const collection = createCollectionApis(client);
42
+ const feeds = createFeedsApis(client);
43
+ const space = createSpaceApis(client);
44
+ const recsys = createRecsysApis(client);
45
+ return {
46
+ tcp,
47
+ prompt,
48
+ artifact,
49
+ gpt,
50
+ audio,
51
+ hashtag,
52
+ activity,
53
+ verse,
54
+ task,
55
+ config,
56
+ user,
57
+ collection,
58
+ feeds,
59
+ space,
60
+ recsys,
61
+ };
62
+ };
@@ -0,0 +1,120 @@
1
+ import { mapTCP2Tag, REF_IMG_PROMPT_PLACEHOLDER, stringToPrompts, } from "../utils/prompts.js";
2
+ const PRESET_DOMAIN_IMG_REF = "APP/单图/图生图";
3
+ export const createPromptApis = (client, tcpApis, artifactApis) => {
4
+ const parseVtokens = async (prompt, options) => {
5
+ const insPrompts = stringToPrompts(prompt, options);
6
+ const refImages = insPrompts.filter((p) => p.type === "ref_image");
7
+ const artifacts = await artifactApis
8
+ .artifactDetail(refImages.map((p) => p.ref_img_uuid ?? ""))
9
+ .catch(() => []);
10
+ artifacts.forEach((artifact) => {
11
+ if (!artifact)
12
+ return;
13
+ if (artifact.status !== "SUCCESS")
14
+ return;
15
+ if (artifact.modality !== "PICTURE")
16
+ return;
17
+ if (!artifact.url)
18
+ return;
19
+ const refImage = refImages.find((p) => p.ref_img_uuid === artifact.uuid);
20
+ if (!refImage)
21
+ return;
22
+ refImage.value = artifact.url;
23
+ });
24
+ const imgModes = refImages.length > 0 ? await img2imgModes() : [];
25
+ const resPrompts = await Promise.all(insPrompts.map(async (p) => {
26
+ if (p.type === "text") {
27
+ return {
28
+ type: "freetext",
29
+ weight: p.weight,
30
+ value: p.value,
31
+ };
32
+ }
33
+ if (p.type === "ref_image") {
34
+ if (p.value === REF_IMG_PROMPT_PLACEHOLDER)
35
+ return null;
36
+ if (!p.ref_img_uuid)
37
+ return null;
38
+ if (!p.value)
39
+ return null;
40
+ const imgMode = imgModes.find((m) => m.name === p.name) ?? imgModes[0];
41
+ if (!imgMode)
42
+ return null;
43
+ return {
44
+ uuid: imgMode.uuid,
45
+ name: imgMode.name,
46
+ type: "ref_image",
47
+ weight: p.weight,
48
+ value: p.value,
49
+ sub_type: p.sub_type,
50
+ ref_img_uuid: p.ref_img_uuid,
51
+ extra_value: imgMode.extra_value,
52
+ };
53
+ }
54
+ if (p.type !== "character" && p.type !== "elementum")
55
+ return null;
56
+ if (p.type === "character") {
57
+ const characterInAssigns = options?.characters?.find((c) => c.name === p.name);
58
+ if (characterInAssigns) {
59
+ return mapTCP2Tag({
60
+ type: "oc",
61
+ uuid: characterInAssigns.uuid,
62
+ name: characterInAssigns.name,
63
+ }, p.weight);
64
+ }
65
+ }
66
+ if (p.type === "elementum") {
67
+ const elementumInAssigns = options?.elementums?.find((s) => s.name === p.name);
68
+ if (elementumInAssigns) {
69
+ return mapTCP2Tag({
70
+ type: "elementum",
71
+ uuid: elementumInAssigns.uuid,
72
+ name: elementumInAssigns.name,
73
+ }, p.weight);
74
+ }
75
+ }
76
+ const res = await tcpApis.searchTCPs({
77
+ keywords: p.name,
78
+ page_index: 0,
79
+ page_size: 1,
80
+ parent_type: p.type === "character" ? "oc" : "elementum",
81
+ sort_scheme: "exact",
82
+ });
83
+ const first = (() => {
84
+ if (!res)
85
+ return null;
86
+ if ("list" in res) {
87
+ if (p.type === "character") {
88
+ return res.list.find((r) => r.type === "oc") ?? null;
89
+ }
90
+ if (p.type === "elementum") {
91
+ return res.list.find((r) => r.type === "elementum") ?? null;
92
+ }
93
+ return null;
94
+ }
95
+ return res;
96
+ })();
97
+ if (first) {
98
+ return mapTCP2Tag(first, p.weight);
99
+ }
100
+ return {
101
+ type: "freetext",
102
+ weight: p.weight,
103
+ value: p.name,
104
+ };
105
+ }));
106
+ return resPrompts.filter((r) => r !== null);
107
+ };
108
+ const img2imgModes = async () => {
109
+ return client
110
+ .get("/v1/prompt/full-prompt-tags", {
111
+ params: { domain_name: PRESET_DOMAIN_IMG_REF },
112
+ })
113
+ .then((res) => res.data.tags)
114
+ .catch(() => []);
115
+ };
116
+ return {
117
+ img2imgModes,
118
+ parseVtokens,
119
+ };
120
+ };
@@ -0,0 +1,29 @@
1
+ export const createRecsysApis = (client) => {
2
+ const suggestKeywords = async (params) => {
3
+ const response = await client.get("/v1/recsys/autocomplete", { params });
4
+ return response.data;
5
+ };
6
+ const suggestTags = async (params) => {
7
+ const response = await client.get("/v1/recsys/tags", { params });
8
+ return response.data;
9
+ };
10
+ const suggestCategories = async (params) => {
11
+ const response = await client.get("/v1/recsys/categories", { params });
12
+ return response.data;
13
+ };
14
+ const suggestContent = async (params) => {
15
+ const response = await client.post("/v1/recsys/content", params);
16
+ return response.data;
17
+ };
18
+ const validateTaxPath = async (params) => {
19
+ const response = await client.post("/v1/recsys/validate-tax-path", params);
20
+ return response.data;
21
+ };
22
+ return {
23
+ suggestKeywords,
24
+ suggestTags,
25
+ suggestCategories,
26
+ suggestContent,
27
+ validateTaxPath,
28
+ };
29
+ };
@@ -0,0 +1,48 @@
1
+ import { safeParseJson } from "../utils/json.js";
2
+ export const createSpaceApis = (client) => {
3
+ const basic = async (hashtag_name) => {
4
+ const res = await client.get("/v1/space/get-by-hashtag", {
5
+ params: {
6
+ hashtag_name,
7
+ },
8
+ });
9
+ return res.data;
10
+ };
11
+ const topics = async (space_uuid) => {
12
+ const res = await client.get("/v1/space/topics", {
13
+ params: {
14
+ space_uuid,
15
+ },
16
+ });
17
+ return res.data;
18
+ };
19
+ const feeds = async (params) => {
20
+ return await client
21
+ .get("/v1/space/collection/feed", {
22
+ params,
23
+ })
24
+ .then((res) => res.data)
25
+ .then((res) => res.collection_feed_item.map((item) => ({
26
+ uuid: item.uuid,
27
+ title: item.title,
28
+ same_style_count: item.same_style_count,
29
+ cover_url: item.cover_url,
30
+ next_view_url: item.next_view_url,
31
+ })));
32
+ };
33
+ const spaceConfigs = async () => {
34
+ const res = await client.get("/v1/configs/config?namespace=space&key=topic_tags_config");
35
+ return safeParseJson(res.data.value) ?? {};
36
+ };
37
+ const spaceHashtags = async () => {
38
+ const res = await client.get("/v1/configs/config?namespace=space&key=new_version_hashtag");
39
+ return safeParseJson(res.data.value) ?? [];
40
+ };
41
+ return {
42
+ basic,
43
+ topics,
44
+ feeds,
45
+ spaceHashtags,
46
+ spaceConfigs,
47
+ };
48
+ };
@@ -0,0 +1,21 @@
1
+ export const createTaskApis = (client) => {
2
+ const rawTask = async (uuid, config) => {
3
+ return client
4
+ .get("/v3/task", {
5
+ params: {
6
+ taskId: uuid,
7
+ },
8
+ ...config,
9
+ })
10
+ .then((res) => res.data);
11
+ };
12
+ const poolSize = async () => {
13
+ return client
14
+ .get("/v3/task-pool")
15
+ .then((res) => res.data);
16
+ };
17
+ return {
18
+ rawTask,
19
+ poolSize,
20
+ };
21
+ };
@@ -0,0 +1,16 @@
1
+ export const createTcpApis = (client) => {
2
+ const searchTCPs = async (query) => {
3
+ return client
4
+ .get("/v2/travel/parent-search", { params: query })
5
+ .then((res) => res.data);
6
+ };
7
+ const tcpProfile = async (uuid) => {
8
+ return client
9
+ .get(`/v2/travel/parent/${uuid}/profile`)
10
+ .then((res) => res.data);
11
+ };
12
+ return {
13
+ searchTCPs,
14
+ tcpProfile,
15
+ };
16
+ };
@@ -0,0 +1,76 @@
1
+ export const IMAGE_GENERATE_ASPECTS = [
2
+ {
3
+ aspect: "1:1",
4
+ size: [512, 512],
5
+ resultSize: [1024, 1024],
6
+ },
7
+ {
8
+ aspect: "3:4",
9
+ size: [576, 768],
10
+ resultSize: [896, 1152],
11
+ },
12
+ {
13
+ aspect: "4:3",
14
+ size: [768, 576],
15
+ resultSize: [1152, 896],
16
+ },
17
+ {
18
+ aspect: "9:16",
19
+ size: [576, 1024],
20
+ resultSize: [768, 1344],
21
+ },
22
+ {
23
+ aspect: "16:9",
24
+ size: [1024, 576],
25
+ resultSize: [1344, 768],
26
+ },
27
+ ];
28
+ export const buildMakeImagePayload = (vtokens, options, inherit) => {
29
+ const { make_image_aspect, advanced_translator, negative_freetext, context_model_series, entrance_uuid, manuscript_uuid, assign_key, toolcall_uuid, } = options;
30
+ const imageAspect = IMAGE_GENERATE_ASPECTS.find((a) => a.aspect === make_image_aspect)?.size ?? [576, 768];
31
+ return {
32
+ storyId: "DO_NOT_USE",
33
+ jobType: "universal",
34
+ rawPrompt: vtokens,
35
+ width: imageAspect[0],
36
+ height: imageAspect[1],
37
+ meta: {
38
+ entrance: "PICTURE,VERSE",
39
+ entrance_uuid,
40
+ manuscript_uuid,
41
+ assign_key,
42
+ toolcall_uuid,
43
+ },
44
+ inherit_params: inherit,
45
+ advanced_translator,
46
+ context_model_series,
47
+ negative_freetext: negative_freetext,
48
+ };
49
+ };
50
+ export const buildMakeVideoPayload = (image_url, work_flow_text, work_flow_model, options) => {
51
+ const { entrance_uuid, manuscript_uuid, inherit_params, assign_key, toolcall_uuid, } = options || {};
52
+ return {
53
+ rawPrompt: [],
54
+ image_url,
55
+ work_flow_text,
56
+ work_flow_model,
57
+ inherit_params,
58
+ meta: {
59
+ entrance: "VIDEO,VERSE",
60
+ entrance_uuid,
61
+ manuscript_uuid,
62
+ assign_key,
63
+ toolcall_uuid,
64
+ },
65
+ };
66
+ };
67
+ export const isTextAssign = (assign) => typeof assign === "string";
68
+ export const isCharacterAssign = (assign) => typeof assign === "object" && assign !== null && assign.type === "character";
69
+ export const isElementumAssign = (assign) => typeof assign === "object" && assign !== null && assign.type === "elementum";
70
+ export const isImageAssign = (assign) => typeof assign === "object" && assign !== null && assign.type === "image";
71
+ export const isVideoAssign = (assign) => typeof assign === "object" && assign !== null && assign.type === "video";
72
+ export const isAudioAssign = (assign) => typeof assign === "object" && assign !== null && assign.type === "audio";
73
+ export const isHtmlTemplateAssign = (assign) => typeof assign === "object" &&
74
+ assign !== null &&
75
+ assign.type === "html_template";
76
+ export const isEmptyAssign = (assign) => assign === null;
@@ -0,0 +1,45 @@
1
+ export const createUserApis = (client) => {
2
+ return {
3
+ me: async () => {
4
+ const res = await client.get("/v1/user/");
5
+ return res.data ?? null;
6
+ },
7
+ subscribeUser: async (params) => {
8
+ const response = await client.request({
9
+ method: "PUT",
10
+ url: "/v1/user/user-subscribe",
11
+ data: {
12
+ user_uuid: params.user_uuid,
13
+ is_cancel: params.is_cancel ?? false,
14
+ },
15
+ });
16
+ return {
17
+ success: response.status === 200 || response.status === 204,
18
+ subscribe_status: response.data
19
+ ?.subscribe_status,
20
+ };
21
+ },
22
+ getSubscribeList: async (params) => {
23
+ const response = await client.request({
24
+ method: "GET",
25
+ url: "/v1/user/subscribe-list",
26
+ params: {
27
+ page_index: params?.page_index ?? 0,
28
+ page_size: params?.page_size ?? 20,
29
+ },
30
+ });
31
+ return response.data;
32
+ },
33
+ getFanList: async (params) => {
34
+ const response = await client.request({
35
+ method: "GET",
36
+ url: "/v1/user/fan-list",
37
+ params: {
38
+ page_index: params?.page_index ?? 0,
39
+ page_size: params?.page_size ?? 20,
40
+ },
41
+ });
42
+ return response.data;
43
+ },
44
+ };
45
+ };
@@ -0,0 +1,18 @@
1
+ export const createVerseApis = (client) => {
2
+ const patchHtml = async (params) => {
3
+ return client
4
+ .post("/v1/verse/modifyhtml", params, {
5
+ timeout: 20 * 1000,
6
+ })
7
+ .then((res) => res.data);
8
+ };
9
+ const versePreset = async (uuid) => client.get(`/v1/verse/preset/${uuid}`).then((res) => res.data);
10
+ const drawRedpacket = async (params) => client
11
+ .post("/v1/redpacket/draw", params)
12
+ .then((res) => res.data);
13
+ return {
14
+ patchHtml,
15
+ versePreset,
16
+ drawRedpacket,
17
+ };
18
+ };
package/bin/cli.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { program } from "@commander-js/extra-typings";
3
+ import dotenv from "dotenv-flow";
4
+ import pkg from "../package.json" with { type: "json" };
5
+ import { buildCommands } from "./commands/load.js";
6
+ // Load environment variables
7
+ dotenv.config();
8
+ program
9
+ .name("neta")
10
+ .description("NETA CLI - Neta API Client")
11
+ .version(pkg.version);
12
+ const cli = program
13
+ .option("--token <string>", "neta token (default: from env NETA_TOKEN)")
14
+ .option("--api_base_url <string>", "api base url (default: NETA_API_BASE_URL or locale-based default)");
15
+ await buildCommands(cli);
16
+ cli.parse(process.argv);
@@ -0,0 +1,4 @@
1
+ name: create_comment
2
+ title: Comment on Collection, Character, or Elementum
3
+ description: Create a comment on a collection, character, or elementum.
4
+