Skip to content

Commit

Permalink
fix some bugs but providers cooked
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 7, 2025
1 parent f59699b commit e8aeb1e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 27 deletions.
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"check": "biome check --apply .",
"preinstall": "npx only-allow bun",
"build": "turbo run build --filter=./packages/*",
"start": "bun --filter=./packages/* --filter=!@elizaos/cli start",
"agent": "bun --filter=@elizaos/agent start",
"dev": "bun --filter=./packages/* dev",
"start": "turbo run start --filter=!./packages/docs",
"agent": "turbo run start --filter=@elizaos/agent",
"dev": "turbo run dev --filter=!./packages/docs",
"release": "bun run build && bun format && npx lerna publish --no-private --force-publish",
"docker:build": "bash ./scripts/docker.sh build",
"docker:run": "bash ./scripts/docker.sh run",
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ const startAgents = async () => {
}

elizaLogger.info(
"Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents. When running multiple agents, use client with different port `SERVER_PORT=3001 pnpm start:client`"
"Run `bun start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents. When running multiple agents, use client with different port `SERVER_PORT=3001 bun start:client`"
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The TEE CLI provides a set of commands to manage your ElizaOS TEE deployments, f
### Prerequisites

- Docker installed and running
- Node.js and npm/pnpm installed
- Node.js and npm/bun installed
- A Docker Hub account for publishing images
- A Phala Cloud (https://cloud.phala.network/login) API key for cloud deployments

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
"release": "changeset version",
"pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
"pub:release": "pnpm build && pnpm publish --access public",
"pub:beta": "bun build && bun publish --no-git-checks --access public --tag beta",
"pub:next": "bun build && bun publish --no-git-checks --access public --tag next",
"pub:release": "bun build && bun publish --access public",
"test": "vitest run",
"test:dev": "REGISTRY_URL=http://localhost:3333 vitest run"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@ async function selectPlugins() {
async function installDependencies(targetDir: string, database: string, selectedPlugins: string[]) {
logger.info("Installing dependencies...")

// Install pnpm if not already installed
await execa("npm", ["install", "-g", "pnpm"], {
// Install bun if not already installed
await execa("npm", ["install", "-g", "bun"], {
stdio: "inherit"
})

// Use pnpm for installation
await execa("pnpm", ["install", "--no-frozen-lockfile"], {
// Use bun for installation
await execa("bun", ["install", "--no-frozen-lockfile"], {
cwd: targetDir,
stdio: "inherit"
})

await execa("pnpm", ["add", `@elizaos/adapter-${database}`, "--workspace-root"], {
await execa("bun", ["add", `@elizaos/adapter-${database}`, "--workspace-root"], {
cwd: targetDir,
stdio: "inherit"
})

if (selectedPlugins.length > 0) {
console.log(selectedPlugins)
await execa("pnpm", ["add", ...selectedPlugins, "--workspace-root"], {
await execa("bun", ["add", ...selectedPlugins, "--workspace-root"], {
cwd: targetDir,
stdio: "inherit"
})
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/tee/phala/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
/bin/sh -c "
cd /app &&
echo {{characterBase64Data}} | base64 -d > characters/{{characterName}}.character.json &&
pnpm run start --non-interactive --character=characters/{{characterName}}.character.json
bun run start --non-interactive --character=characters/{{characterName}}.character.json
"
stdin_open: true
tty: true
Expand Down
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"extract-version": "bash ./version.sh",
"start": "bun run extract-version && vite",
"dev": "bun run extract-version && vite",
"build": "bun run extract-version && tsc -b && vite build",
"preview": "vite preview"
Expand Down
18 changes: 8 additions & 10 deletions packages/core/src/generation.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// ================ IMPORTS ================
import { createOpenAI } from "@ai-sdk/openai";
import { createAnthropic } from "@ai-sdk/anthropic";
import { createOpenAI } from "@ai-sdk/openai";
import {
experimental_generateImage as aiGenerateImage,
generateObject as aiGenerateObject,
generateText as aiGenerateText,
type JSONValue,
type StepResult as AIStepResult,
type CoreTool,
type GenerateObjectResult,
type JSONValue
} from "ai";
import { object, z, type ZodSchema } from "zod";
import { z, type ZodSchema } from "zod";
import { elizaLogger, logFunctionCall } from "./index.ts";
import {
parseJSONObjectFromText
Expand All @@ -22,8 +21,7 @@ import {
type IAgentRuntime,
type IImageDescriptionService,
ModelClass,
ServiceType,
type TelemetrySettings,
ServiceType
} from "./types.ts";


Expand Down Expand Up @@ -89,8 +87,8 @@ async function withRetry<T>(
function isAnthropicProvider(runtime: IAgentRuntime): boolean {
const provider = runtime.getModelProvider()?.provider;
return (
provider.toLowerCase().includes("anthropic") ||
provider.toLowerCase().includes("claude")
provider?.toLowerCase().includes("anthropic") ||
provider?.toLowerCase().includes("claude")
);
}

Expand Down Expand Up @@ -119,7 +117,7 @@ function validateModelConfig(
) {
const validations = [
{ value: config.apiKey, name: 'API key', for: provider },
{ value: config.baseURL, name: 'endpoint URL', for: provider },
// { value: config.baseURL, name: 'endpoint URL', for: provider },
{ value: config.modelProvider, name: 'model provider' },
{ value: config.modelProvider?.models, name: 'model configurations', in: 'provider' },
{ value: config.model, name: 'model name', for: `class ${config.modelClass}` }
Expand Down Expand Up @@ -149,7 +147,7 @@ export function initializeModelClient(runtime: IAgentRuntime, modelClass: ModelC

const modelProvider = runtime.getModelProvider();
const modelConfig = modelProvider?.models?.[modelClass];
const model = modelConfig?.name;
const model = modelConfig?.name || "gpt-4o";

// Single validation call replaces multiple if-checks
validateModelConfig(provider, {
Expand Down
11 changes: 9 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"],
"cache": false
"outputs": ["dist/**"]
},
"start": {
"dependsOn": ["build"],
"persistent": true
},
"dev": {
"persistent": true,
"dependsOn": ["build"]
}
}
}

0 comments on commit e8aeb1e

Please sign in to comment.