Skip to content

Commit

Permalink
fix typo on case
Browse files Browse the repository at this point in the history
  • Loading branch information
Xm0onh committed Jan 4, 2025
1 parent 575c1b2 commit e607f53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { dsnDataType } from '../types.js';
import { DsnDataType } from '../types.js';
import { engagementSchema, responseSchema, skippedEngagementSchema, dsnTweet } from '../schemas.js';
import { writeFileSync } from 'fs';
import { join } from 'path';
Expand All @@ -15,7 +15,7 @@ const dsnCommonFields = z.object({
const extractDsnResponseSchema = () => {
const schema = z
.object({
type: z.literal(dsnDataType.RESPONSE),
type: z.literal(DsnDataType.RESPONSE),
tweet: dsnTweet,
decision: engagementSchema,
})
Expand All @@ -28,7 +28,7 @@ const extractDsnResponseSchema = () => {
const extractDsnSkippedEngagementSchema = () => {
const schema = z
.object({
type: z.literal(dsnDataType.SKIPPED_ENGAGEMENT),
type: z.literal(DsnDataType.SKIPPED_ENGAGEMENT),
tweet: dsnTweet,
})
.merge(skippedEngagementSchema)
Expand All @@ -40,7 +40,7 @@ const extractDsnSkippedEngagementSchema = () => {
const extractDsnGeneratedTweetSchema = () => {
const schema = z
.object({
type: z.literal(dsnDataType.GENERATED_TWEET),
type: z.literal(DsnDataType.GENERATED_TWEET),
content: z.string(),
tweetId: z.string().nullable(),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
dsnData,
DsnData,
DsnGeneratedTweetData,
DsnResponseData,
DsnSkippedEngagementData,
EngagementDecision,
WorkflowConfig,
dsnDataType,
DsnDataType,
} from '../types.js';
import { createLogger } from '../../../../utils/logger.js';
import { State } from '../workflow.js';
Expand Down Expand Up @@ -100,11 +100,11 @@ export const createGenerateTweetNode =
const postedTweet = await invokePostTweetTool(config.toolNode, generatedTweet.tweet);

// Transform the data into an array format expected by DSN
const formattedDsnData: dsnData[] = [
const formattedDsnData: DsnData[] = [
...postedResponses.map(
response =>
({
type: dsnDataType.RESPONSE,
type: DsnDataType.RESPONSE,
tweet: response.tweet,
content: response.content,
strategy: response.strategy,
Expand All @@ -117,13 +117,13 @@ export const createGenerateTweetNode =
...shouldNotEngage.map(
item =>
({
type: dsnDataType.SKIPPED_ENGAGEMENT,
type: DsnDataType.SKIPPED_ENGAGEMENT,
decision: item.decision,
tweet: item.tweet,
}) as DsnSkippedEngagementData,
),
{
type: dsnDataType.GENERATED_TWEET,
type: DsnDataType.GENERATED_TWEET,
content: generatedTweet.tweet,
tweetId: postedTweet ? postedTweet.postedTweetId : null,
} as DsnGeneratedTweetData,
Expand Down
10 changes: 5 additions & 5 deletions auto-agents-framework/src/agents/workflows/kol/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Runnable } from '@langchain/core/runnables';
import { engagementSchema, responseSchema, skippedEngagementSchema, dsnTweet } from './schemas.js';
import { ChatPromptTemplate } from '@langchain/core/prompts';

export enum dsnDataType {
export enum DsnDataType {
RESPONSE = 'response',
SKIPPED_ENGAGEMENT = 'skipped',
GENERATED_TWEET = 'posted',
Expand Down Expand Up @@ -37,20 +37,20 @@ export type EngagementDecision = {
};

export type DsnResponseData = {
type: dsnDataType.RESPONSE;
type: DsnDataType.RESPONSE;
tweet: z.infer<typeof dsnTweet>;
decision: z.infer<typeof engagementSchema>;
} & z.infer<typeof responseSchema>;

export type DsnSkippedEngagementData = {
type: dsnDataType.SKIPPED_ENGAGEMENT;
type: DsnDataType.SKIPPED_ENGAGEMENT;
tweet: z.infer<typeof dsnTweet>;
} & z.infer<typeof skippedEngagementSchema>;

export type DsnGeneratedTweetData = {
type: dsnDataType.GENERATED_TWEET;
type: DsnDataType.GENERATED_TWEET;
content: string;
tweetId: string | null;
};

export type dsnData = DsnResponseData | DsnSkippedEngagementData | DsnGeneratedTweetData;
export type DsnData = DsnResponseData | DsnSkippedEngagementData | DsnGeneratedTweetData;

0 comments on commit e607f53

Please sign in to comment.