@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.
- package/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.en.md +234 -0
- package/README.md +237 -0
- package/bin/apis/activity.js +14 -0
- package/bin/apis/artifact.js +64 -0
- package/bin/apis/audio.js +10 -0
- package/bin/apis/collection.js +87 -0
- package/bin/apis/config.js +49 -0
- package/bin/apis/feeds.js +34 -0
- package/bin/apis/gpt.js +10 -0
- package/bin/apis/hashtag.js +23 -0
- package/bin/apis/index.js +62 -0
- package/bin/apis/prompt.js +120 -0
- package/bin/apis/recsys.js +29 -0
- package/bin/apis/space.js +48 -0
- package/bin/apis/task.js +21 -0
- package/bin/apis/tcp.js +16 -0
- package/bin/apis/types.js +76 -0
- package/bin/apis/user.js +45 -0
- package/bin/apis/verse.js +18 -0
- package/bin/cli.js +16 -0
- package/bin/commands/community/create_comment.cmd.en_us.yml +4 -0
- package/bin/commands/community/create_comment.cmd.js +40 -0
- package/bin/commands/community/create_comment.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/favor_collection.cmd.en_us.yml +4 -0
- package/bin/commands/community/favor_collection.cmd.js +29 -0
- package/bin/commands/community/favor_collection.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/get_fan_list.cmd.en_us.yml +4 -0
- package/bin/commands/community/get_fan_list.cmd.js +36 -0
- package/bin/commands/community/get_fan_list.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/get_hashtag_characters.cmd.en_us.yml +4 -0
- package/bin/commands/community/get_hashtag_characters.cmd.js +46 -0
- package/bin/commands/community/get_hashtag_characters.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/get_hashtag_collections.cmd.en_us.yml +6 -0
- package/bin/commands/community/get_hashtag_collections.cmd.js +54 -0
- package/bin/commands/community/get_hashtag_collections.cmd.zh_cn.yml +5 -0
- package/bin/commands/community/get_hashtag_info.cmd.en_us.yml +4 -0
- package/bin/commands/community/get_hashtag_info.cmd.js +42 -0
- package/bin/commands/community/get_hashtag_info.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/get_subscribe_list.cmd.en_us.yml +4 -0
- package/bin/commands/community/get_subscribe_list.cmd.js +36 -0
- package/bin/commands/community/get_subscribe_list.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/like_collection.cmd.en_us.yml +4 -0
- package/bin/commands/community/like_collection.cmd.js +29 -0
- package/bin/commands/community/like_collection.cmd.zh_cn.yml +4 -0
- package/bin/commands/community/list_space_topics.cmd.en_us.yml +7 -0
- package/bin/commands/community/list_space_topics.cmd.js +39 -0
- package/bin/commands/community/list_space_topics.cmd.zh_cn.yml +6 -0
- package/bin/commands/community/list_spaces.cmd.en_us.yml +4 -0
- package/bin/commands/community/list_spaces.cmd.js +19 -0
- package/bin/commands/community/list_spaces.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/read_collection.cmd.en_us.yml +4 -0
- package/bin/commands/community/read_collection.cmd.js +83 -0
- package/bin/commands/community/read_collection.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/request_interactive_feed.cmd.en_us.yml +4 -0
- package/bin/commands/community/request_interactive_feed.cmd.js +54 -0
- package/bin/commands/community/request_interactive_feed.cmd.zh_cn.yml +5 -0
- package/bin/commands/community/subscribe_user.cmd.en_us.yml +4 -0
- package/bin/commands/community/subscribe_user.cmd.js +33 -0
- package/bin/commands/community/subscribe_user.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/suggest_categories.cmd.en_us.yml +4 -0
- package/bin/commands/community/suggest_categories.cmd.js +26 -0
- package/bin/commands/community/suggest_categories.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/suggest_content.cmd.en_us.yml +5 -0
- package/bin/commands/community/suggest_content.cmd.js +59 -0
- package/bin/commands/community/suggest_content.cmd.zh_cn.yml +4 -0
- package/bin/commands/community/suggest_keywords.cmd.en_us.yml +4 -0
- package/bin/commands/community/suggest_keywords.cmd.js +26 -0
- package/bin/commands/community/suggest_keywords.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/suggest_tags.cmd.en_us.yml +4 -0
- package/bin/commands/community/suggest_tags.cmd.js +26 -0
- package/bin/commands/community/suggest_tags.cmd.zh_cn.yml +3 -0
- package/bin/commands/community/validate_tax_path.cmd.en_us.yml +4 -0
- package/bin/commands/community/validate_tax_path.cmd.js +24 -0
- package/bin/commands/community/validate_tax_path.cmd.zh_cn.yml +3 -0
- package/bin/commands/creative/edit_colleciton.cmd.en_us.yml +11 -0
- package/bin/commands/creative/edit_colleciton.cmd.js +140 -0
- package/bin/commands/creative/edit_colleciton.cmd.zh_cn.yml +10 -0
- package/bin/commands/creative/make_image.cmd.en_us.yml +20 -0
- package/bin/commands/creative/make_image.cmd.js +58 -0
- package/bin/commands/creative/make_image.cmd.zh_cn.yml +19 -0
- package/bin/commands/creative/make_song.cmd.en_us.yml +8 -0
- package/bin/commands/creative/make_song.cmd.js +53 -0
- package/bin/commands/creative/make_song.cmd.zh_cn.yml +7 -0
- package/bin/commands/creative/make_video.cmd.en_us.yml +17 -0
- package/bin/commands/creative/make_video.cmd.js +54 -0
- package/bin/commands/creative/make_video.cmd.zh_cn.yml +16 -0
- package/bin/commands/creative/publish_collection.cmd.en_us.yml +10 -0
- package/bin/commands/creative/publish_collection.cmd.js +101 -0
- package/bin/commands/creative/publish_collection.cmd.zh_cn.yml +9 -0
- package/bin/commands/creative/remove_background.cmd.en_us.yml +10 -0
- package/bin/commands/creative/remove_background.cmd.js +74 -0
- package/bin/commands/creative/remove_background.cmd.zh_cn.yml +9 -0
- package/bin/commands/creative/request_character_or_elementum.cmd.en_us.yml +23 -0
- package/bin/commands/creative/request_character_or_elementum.cmd.js +108 -0
- package/bin/commands/creative/request_character_or_elementum.cmd.zh_cn.yml +22 -0
- package/bin/commands/creative/search_tcp.cmd.en_us.yml +16 -0
- package/bin/commands/creative/search_tcp.cmd.js +53 -0
- package/bin/commands/creative/search_tcp.cmd.zh_cn.yml +15 -0
- package/bin/commands/factory.js +15 -0
- package/bin/commands/load.js +157 -0
- package/bin/utils/errors.js +61 -0
- package/bin/utils/json.js +8 -0
- package/bin/utils/lang.js +8 -0
- package/bin/utils/parse_meta.js +16 -0
- package/bin/utils/polling.js +17 -0
- package/bin/utils/prompts.js +186 -0
- package/package.json +77 -0
- package/skills/neta/SKILL.md +119 -0
- package/skills/neta-community/SKILL.md +123 -0
- package/skills/neta-creative/SKILL.md +118 -0
- package/skills/neta-space/SKILL.md +129 -0
- package/skills/neta-suggest/SKILL.md +490 -0
- package/skills/zh_cn/neta/SKILL.md +111 -0
- package/skills/zh_cn/neta/references/character-search.md +234 -0
- package/skills/zh_cn/neta/references/collection-remix.md +40 -0
- package/skills/zh_cn/neta/references/community-exploration.md +636 -0
- package/skills/zh_cn/neta/references/hashtag-research.md +295 -0
- package/skills/zh_cn/neta/references/image-generation.md +121 -0
- package/skills/zh_cn/neta/references/interactive-feed.md +377 -0
- package/skills/zh_cn/neta/references/social-interactive.md +73 -0
- package/skills/zh_cn/neta/references/song-creation.md +247 -0
- package/skills/zh_cn/neta/references/song-mv.md +198 -0
- package/skills/zh_cn/neta/references/space.md +90 -0
- package/skills/zh_cn/neta/references/video-generation.md +221 -0
- package/skills/zh_cn/neta-community/SKILL.md +109 -0
- package/skills/zh_cn/neta-community/references/character-search.md +233 -0
- package/skills/zh_cn/neta-community/references/hashtag-research.md +295 -0
- package/skills/zh_cn/neta-community/references/interactive-feed.md +377 -0
- package/skills/zh_cn/neta-community/references/social-interactive.md +73 -0
- package/skills/zh_cn/neta-creative/SKILL.md +105 -0
- package/skills/zh_cn/neta-creative/references/character-search.md +233 -0
- package/skills/zh_cn/neta-creative/references/collection-remix.md +40 -0
- package/skills/zh_cn/neta-creative/references/image-generation.md +121 -0
- package/skills/zh_cn/neta-creative/references/song-creation.md +247 -0
- package/skills/zh_cn/neta-creative/references/song-mv.md +198 -0
- package/skills/zh_cn/neta-creative/references/video-generation.md +221 -0
- package/skills/zh_cn/neta-space/SKILL.md +126 -0
- package/skills/zh_cn/neta-suggest/SKILL.md +662 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const createCommentCmd = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
inputSchema: Type.Object({
|
|
14
|
+
content: Type.String({ minLength: 1, maxLength: 500 }),
|
|
15
|
+
parent_uuid: Type.String(),
|
|
16
|
+
parent_type: Type.Union([Type.Literal("collection")]),
|
|
17
|
+
at_users: Type.String({ default: "" }),
|
|
18
|
+
}),
|
|
19
|
+
}, async ({ content, parent_uuid, parent_type, at_users }, { apis }) => {
|
|
20
|
+
const atUsersArray = at_users
|
|
21
|
+
? at_users
|
|
22
|
+
.split(",")
|
|
23
|
+
.map((uuid) => uuid.trim())
|
|
24
|
+
.filter(Boolean)
|
|
25
|
+
: [];
|
|
26
|
+
const result = await apis.collection.createComment({
|
|
27
|
+
content,
|
|
28
|
+
parent_uuid,
|
|
29
|
+
parent_type,
|
|
30
|
+
at_users: atUsersArray,
|
|
31
|
+
});
|
|
32
|
+
if (!result.success) {
|
|
33
|
+
throw new Error("create_comment fail");
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
success: true,
|
|
37
|
+
comment_uuid: result.comment?.uuid,
|
|
38
|
+
message: "create_comment success",
|
|
39
|
+
};
|
|
40
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const favorCollectionCmd = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
inputSchema: Type.Object({
|
|
14
|
+
uuid: Type.String(),
|
|
15
|
+
is_cancel: Type.Boolean({
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
}, async ({ uuid, is_cancel }, { apis }) => {
|
|
20
|
+
const action = is_cancel ? "cancel_favor" : "favor";
|
|
21
|
+
const result = await apis.collection.favorCollection(uuid, { is_cancel });
|
|
22
|
+
if (!result.success) {
|
|
23
|
+
throw new Error(`${action} fail`);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
success: true,
|
|
27
|
+
message: `${action} success`,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const getFanListCmd = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
inputSchema: Type.Object({
|
|
14
|
+
page_index: Type.Integer({ minimum: 0, default: 0 }),
|
|
15
|
+
page_size: Type.Integer({ minimum: 1, maximum: 50, default: 20 }),
|
|
16
|
+
}),
|
|
17
|
+
}, async ({ page_index, page_size }, { apis }) => {
|
|
18
|
+
const result = await apis.user.getFanList({
|
|
19
|
+
page_index,
|
|
20
|
+
page_size,
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
total: result.total,
|
|
24
|
+
page_index: result.page_index,
|
|
25
|
+
page_size: result.page_size,
|
|
26
|
+
list: result.list.map((user) => ({
|
|
27
|
+
uuid: user.uuid,
|
|
28
|
+
name: user.name,
|
|
29
|
+
avatar_url: user.avatar_url,
|
|
30
|
+
total_fans: user.total_fans,
|
|
31
|
+
total_collections: user.total_collections,
|
|
32
|
+
subscribe_status: user.subscribe_status,
|
|
33
|
+
})),
|
|
34
|
+
has_next: result.has_next,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
const fetchCharactersByHashtagV1Parameters = Type.Object({
|
|
10
|
+
hashtag: Type.String(),
|
|
11
|
+
page_index: Type.Integer({ minimum: 0, default: 0 }),
|
|
12
|
+
page_size: Type.Integer({ minimum: 1, maximum: 100, default: 20 }),
|
|
13
|
+
sort_by: Type.Union([Type.Literal("hot"), Type.Literal("newest")], {
|
|
14
|
+
default: "hot",
|
|
15
|
+
}),
|
|
16
|
+
parent_type: Type.Optional(Type.Union([Type.Literal("oc"), Type.Literal("elementum")])),
|
|
17
|
+
});
|
|
18
|
+
export const getHashtagCharacters = createCommand({
|
|
19
|
+
name: meta.name,
|
|
20
|
+
title: meta.title,
|
|
21
|
+
description: meta.description,
|
|
22
|
+
inputSchema: fetchCharactersByHashtagV1Parameters,
|
|
23
|
+
}, async ({ hashtag, page_index, page_size, sort_by, parent_type }, { apis }) => {
|
|
24
|
+
const result = await apis.hashtag.fetchCharactersByHashtag(hashtag, {
|
|
25
|
+
page_index,
|
|
26
|
+
page_size,
|
|
27
|
+
sort_by,
|
|
28
|
+
parent_type,
|
|
29
|
+
});
|
|
30
|
+
const simplifiedList = result.list.map((char) => ({
|
|
31
|
+
uuid: char.uuid,
|
|
32
|
+
name: char.name,
|
|
33
|
+
short_name: char.short_name,
|
|
34
|
+
avatar_img: char.config?.avatar_img || null,
|
|
35
|
+
ctime: char.ctime,
|
|
36
|
+
creator_uuid: char.creator?.uuid,
|
|
37
|
+
creator_name: char.creator?.nick_name,
|
|
38
|
+
}));
|
|
39
|
+
return {
|
|
40
|
+
total: result.total,
|
|
41
|
+
page_index: result.page_index,
|
|
42
|
+
page_size: result.page_size,
|
|
43
|
+
list: simplifiedList,
|
|
44
|
+
has_next: result.has_next,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
errors: Type.Object({
|
|
9
|
+
no_activity_space: Type.String(),
|
|
10
|
+
}),
|
|
11
|
+
}), import.meta);
|
|
12
|
+
const fetchSelectedCollectionsByHashtagV1Parameters = Type.Object({
|
|
13
|
+
hashtag: Type.String(),
|
|
14
|
+
page_index: Type.Integer({ minimum: 0, default: 0 }),
|
|
15
|
+
page_size: Type.Integer({ minimum: 1, maximum: 100, default: 20 }),
|
|
16
|
+
sort_by: Type.Union([Type.Literal("highlight_mark_time")], {
|
|
17
|
+
default: "highlight_mark_time",
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
export const getHashtagCollections = createCommand({
|
|
21
|
+
name: meta.name,
|
|
22
|
+
title: meta.title,
|
|
23
|
+
description: meta.description,
|
|
24
|
+
inputSchema: fetchSelectedCollectionsByHashtagV1Parameters,
|
|
25
|
+
}, async ({ hashtag, page_index = 0, page_size = 20, sort_by = "highlight_mark_time", }, { apis }) => {
|
|
26
|
+
// 通过hashtag获取对应的activity_uuid
|
|
27
|
+
const hashtagResult = await apis.hashtag.fetchHashtag(hashtag);
|
|
28
|
+
const activityDetail = hashtagResult?.activity_detail;
|
|
29
|
+
const activity_uuid = activityDetail?.uuid;
|
|
30
|
+
if (!activity_uuid) {
|
|
31
|
+
throw new Error(meta.errors.no_activity_space.replace("{hashtag}", String(hashtag ?? "").trim()));
|
|
32
|
+
}
|
|
33
|
+
const result = await apis.activity.fetchSelectedCollections(activity_uuid, {
|
|
34
|
+
page_index,
|
|
35
|
+
page_size,
|
|
36
|
+
sort_by,
|
|
37
|
+
});
|
|
38
|
+
// 转换API返回结果为工具输出格式
|
|
39
|
+
const simplifiedList = (result.list || []).map((collection) => ({
|
|
40
|
+
uuid: collection.storyId,
|
|
41
|
+
name: collection.name,
|
|
42
|
+
coverUrl: collection.coverUrl,
|
|
43
|
+
creator_name: collection.user_nick_name,
|
|
44
|
+
likeCount: collection.likeCount,
|
|
45
|
+
sameStyleCount: collection.sameStyleCount,
|
|
46
|
+
ctime: collection.ctime,
|
|
47
|
+
}));
|
|
48
|
+
return {
|
|
49
|
+
total: result.total,
|
|
50
|
+
page_index: result.page_index,
|
|
51
|
+
page_size: result.page_size,
|
|
52
|
+
list: simplifiedList,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
const fetchHashtagV1Parameters = Type.Object({
|
|
10
|
+
hashtag: Type.String(),
|
|
11
|
+
});
|
|
12
|
+
export const getHashtagInfo = createCommand({
|
|
13
|
+
name: meta.name,
|
|
14
|
+
title: meta.title,
|
|
15
|
+
description: meta.description,
|
|
16
|
+
inputSchema: fetchHashtagV1Parameters,
|
|
17
|
+
}, async ({ hashtag }, { apis }) => {
|
|
18
|
+
const result = await apis.hashtag.fetchHashtag(hashtag);
|
|
19
|
+
// 转换API返回结果为工具输出格式
|
|
20
|
+
const activityDetail = result["activity_detail"];
|
|
21
|
+
const simplifiedActivityDetail = activityDetail
|
|
22
|
+
? {
|
|
23
|
+
uuid: activityDetail.uuid,
|
|
24
|
+
title: activityDetail.title,
|
|
25
|
+
banner_pic: activityDetail.banner_pic,
|
|
26
|
+
creator_name: activityDetail.creator_name,
|
|
27
|
+
review_users: activityDetail.review_users?.map((user) => ({
|
|
28
|
+
uuid: user.uuid,
|
|
29
|
+
name: user.name,
|
|
30
|
+
})) ?? null,
|
|
31
|
+
}
|
|
32
|
+
: null;
|
|
33
|
+
return {
|
|
34
|
+
hashtag: {
|
|
35
|
+
name: result.name,
|
|
36
|
+
lore: result.lore || [],
|
|
37
|
+
activity_detail: simplifiedActivityDetail,
|
|
38
|
+
hashtag_heat: result.hashtag_heat,
|
|
39
|
+
subscribe_count: result.subscribe_count,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const getSubscribeListCmd = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
inputSchema: Type.Object({
|
|
14
|
+
page_index: Type.Integer({ minimum: 0, default: 0 }),
|
|
15
|
+
page_size: Type.Integer({ minimum: 1, maximum: 50, default: 20 }),
|
|
16
|
+
}),
|
|
17
|
+
}, async ({ page_index, page_size }, { apis }) => {
|
|
18
|
+
const result = await apis.user.getSubscribeList({
|
|
19
|
+
page_index,
|
|
20
|
+
page_size,
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
total: result.total,
|
|
24
|
+
page_index: result.page_index,
|
|
25
|
+
page_size: result.page_size,
|
|
26
|
+
list: result.list.map((user) => ({
|
|
27
|
+
uuid: user.uuid,
|
|
28
|
+
name: user.name,
|
|
29
|
+
avatar_url: user.avatar_url,
|
|
30
|
+
total_fans: user.total_fans,
|
|
31
|
+
total_collections: user.total_collections,
|
|
32
|
+
subscribe_status: user.subscribe_status,
|
|
33
|
+
})),
|
|
34
|
+
has_next: result.has_next,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const likeCollectionCmd = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
inputSchema: Type.Object({
|
|
14
|
+
uuid: Type.String(),
|
|
15
|
+
is_cancel: Type.Boolean({
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
}, async ({ uuid, is_cancel }, { apis }) => {
|
|
20
|
+
const action = is_cancel ? "unliked" : "liked";
|
|
21
|
+
const success = await apis.collection.likeCollection(uuid, { is_cancel });
|
|
22
|
+
if (!success) {
|
|
23
|
+
throw new Error(`${action} fail`);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
success: true,
|
|
27
|
+
message: `${action} success`,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
parameters: Type.Object({
|
|
9
|
+
space_uuid: Type.String(),
|
|
10
|
+
}),
|
|
11
|
+
}), import.meta);
|
|
12
|
+
export const listSpaceTopics = createCommand({
|
|
13
|
+
name: meta.name,
|
|
14
|
+
title: meta.title,
|
|
15
|
+
description: meta.description,
|
|
16
|
+
inputSchema: Type.Object({
|
|
17
|
+
space_uuid: Type.String(),
|
|
18
|
+
}),
|
|
19
|
+
}, async ({ space_uuid }, { apis }) => {
|
|
20
|
+
const spaceConfigs = await apis.space.spaceConfigs();
|
|
21
|
+
const topics = await apis.space
|
|
22
|
+
.topics(space_uuid)
|
|
23
|
+
.then(({ primary_topic, topics }) => {
|
|
24
|
+
return {
|
|
25
|
+
primary_topic,
|
|
26
|
+
topics: topics.map((topic) => {
|
|
27
|
+
const { curated_works, ...config } = spaceConfigs[topic.hashtag_name] ?? {};
|
|
28
|
+
return {
|
|
29
|
+
...topic,
|
|
30
|
+
...config,
|
|
31
|
+
official_collections: curated_works,
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
topics,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const listSpaces = createCommand({
|
|
10
|
+
name: meta.name,
|
|
11
|
+
title: meta.title,
|
|
12
|
+
description: meta.description,
|
|
13
|
+
}, async (_, { apis }) => {
|
|
14
|
+
const spaceHashtags = await apis.space.spaceHashtags();
|
|
15
|
+
const spaces = await Promise.all(spaceHashtags.map((hashtag) => apis.space.basic(hashtag))).then((spaces) => spaces.filter((space) => space?.space_uuid));
|
|
16
|
+
return {
|
|
17
|
+
spaces,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { isVerseCTA } from "../../apis/collection.js";
|
|
3
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
4
|
+
import { createCommand } from "../factory.js";
|
|
5
|
+
const mete = parseMeta(Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
title: Type.String(),
|
|
8
|
+
description: Type.String(),
|
|
9
|
+
}), import.meta);
|
|
10
|
+
export const readCollectionCmd = createCommand({
|
|
11
|
+
name: mete.name,
|
|
12
|
+
title: mete.title,
|
|
13
|
+
description: mete.description,
|
|
14
|
+
inputSchema: Type.Object({
|
|
15
|
+
uuid: Type.String(),
|
|
16
|
+
}),
|
|
17
|
+
}, async ({ uuid }, { apis }) => {
|
|
18
|
+
const res = await apis.feeds.interactiveItem({ collection_uuid: uuid });
|
|
19
|
+
if (!res || res.template_id !== "NORMAL") {
|
|
20
|
+
throw new Error(`Collection "${uuid}" not found`);
|
|
21
|
+
}
|
|
22
|
+
const name = res.json_data.name;
|
|
23
|
+
const description = res.json_data.description ?? "";
|
|
24
|
+
const creator = {
|
|
25
|
+
uuid: res.json_data.creator.uuid,
|
|
26
|
+
name: res.json_data.creator.nick_name,
|
|
27
|
+
};
|
|
28
|
+
const artifacts = res.json_data.displayData?.pages.flatMap((page) => page.images.map((image) => ({
|
|
29
|
+
uuid: image.uuid,
|
|
30
|
+
url: image.url,
|
|
31
|
+
modality: image.modality,
|
|
32
|
+
status: image.status,
|
|
33
|
+
image_detail: image.image_detail,
|
|
34
|
+
video_detail: image.video_detail,
|
|
35
|
+
})));
|
|
36
|
+
const tags = await apis.feeds
|
|
37
|
+
.tags(uuid)
|
|
38
|
+
.then((res) => res.map((tag) => ({
|
|
39
|
+
name: tag.name,
|
|
40
|
+
type: tag.type,
|
|
41
|
+
participants_count: tag.participants_count,
|
|
42
|
+
header_pic_url: tag.header_pic_url,
|
|
43
|
+
})))
|
|
44
|
+
.catch(() => []);
|
|
45
|
+
const remix = await (async () => {
|
|
46
|
+
const cta = res.json_data.cta_info;
|
|
47
|
+
const verse_uuid = isVerseCTA(cta)
|
|
48
|
+
? (cta.interactive_config?.verse_uuid ?? null)
|
|
49
|
+
: null;
|
|
50
|
+
const verse = verse_uuid
|
|
51
|
+
? await apis.verse.versePreset(verse_uuid).catch(() => null)
|
|
52
|
+
: null;
|
|
53
|
+
const preset_description = verse?.preset_description ?? null;
|
|
54
|
+
const reference_planning = verse?.reference_planning ?? null;
|
|
55
|
+
if (isVerseCTA(cta)) {
|
|
56
|
+
const { interactive_config, interactive_status: _, type: __, ...rest } = cta;
|
|
57
|
+
if (!interactive_config?.verse_uuid)
|
|
58
|
+
return null;
|
|
59
|
+
const verse = await apis.verse
|
|
60
|
+
.versePreset(interactive_config.verse_uuid)
|
|
61
|
+
.catch(() => null);
|
|
62
|
+
if (!verse)
|
|
63
|
+
return null;
|
|
64
|
+
return {
|
|
65
|
+
...rest,
|
|
66
|
+
preset_description,
|
|
67
|
+
reference_planning,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
})();
|
|
72
|
+
return {
|
|
73
|
+
collection: {
|
|
74
|
+
uuid,
|
|
75
|
+
name,
|
|
76
|
+
description,
|
|
77
|
+
creator,
|
|
78
|
+
artifacts,
|
|
79
|
+
tags,
|
|
80
|
+
remix,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { parseMeta } from "../../utils/parse_meta.js";
|
|
3
|
+
import { createCommand } from "../factory.js";
|
|
4
|
+
const meta = parseMeta(Type.Object({
|
|
5
|
+
name: Type.String(),
|
|
6
|
+
title: Type.String(),
|
|
7
|
+
description: Type.String(),
|
|
8
|
+
}), import.meta);
|
|
9
|
+
export const requestInteractiveFeedInputSchema = Type.Object({
|
|
10
|
+
page_index: Type.Integer({ minimum: 0, default: 0 }),
|
|
11
|
+
page_size: Type.Integer({ minimum: 1, maximum: 40, default: 20 }),
|
|
12
|
+
biz_trace_id: Type.Optional(Type.String()),
|
|
13
|
+
scene: Type.String({ default: "agent_intent" }),
|
|
14
|
+
collection_uuid: Type.Optional(Type.String()),
|
|
15
|
+
target_collection_uuid: Type.Optional(Type.String()),
|
|
16
|
+
target_user_uuid: Type.Optional(Type.String()),
|
|
17
|
+
});
|
|
18
|
+
// 复用 collection.ts 中的类型定义
|
|
19
|
+
export const requestInteractiveFeedOutputSchema = Type.Object({
|
|
20
|
+
module_list_header: Type.Null(),
|
|
21
|
+
module_list: Type.Array(Type.Object({
|
|
22
|
+
data_id: Type.String(),
|
|
23
|
+
module_id: Type.String(),
|
|
24
|
+
template_id: Type.String(),
|
|
25
|
+
json_data: Type.Record(Type.String(), Type.Unknown()),
|
|
26
|
+
})),
|
|
27
|
+
page_data: Type.Object({
|
|
28
|
+
page_index: Type.Optional(Type.Number()),
|
|
29
|
+
page_size: Type.Optional(Type.Number()),
|
|
30
|
+
has_next_page: Type.Optional(Type.Boolean()),
|
|
31
|
+
biz_trace_id: Type.Optional(Type.String()),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
export const requestInteractiveFeed = createCommand({
|
|
35
|
+
name: meta.name,
|
|
36
|
+
title: meta.title,
|
|
37
|
+
description: meta.description,
|
|
38
|
+
inputSchema: requestInteractiveFeedInputSchema,
|
|
39
|
+
}, async (params, { apis }) => {
|
|
40
|
+
const result = await apis.feeds.interactiveList({
|
|
41
|
+
page_index: params.page_index,
|
|
42
|
+
page_size: params.page_size,
|
|
43
|
+
biz_trace_id: params.biz_trace_id,
|
|
44
|
+
scene: params.scene,
|
|
45
|
+
collection_uuid: params.collection_uuid,
|
|
46
|
+
target_collection_uuid: params.target_collection_uuid,
|
|
47
|
+
target_user_uuid: params.target_user_uuid,
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
module_list_header: result.module_list_header,
|
|
51
|
+
module_list: result.module_list,
|
|
52
|
+
page_data: result.page_data,
|
|
53
|
+
};
|
|
54
|
+
});
|