sonamu 0.7.12 → 0.7.13
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/dist/api/config.d.ts +0 -3
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +1 -1
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +14 -4
- package/dist/bin/cli.js +2 -58
- package/dist/syncer/api-parser.d.ts.map +1 -1
- package/dist/syncer/api-parser.js +3 -2
- package/dist/syncer/syncer.d.ts +2 -1
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +17 -18
- package/dist/types/types.d.ts +1 -1
- package/dist/ui/ai-api.d.ts +1 -0
- package/dist/ui/ai-api.d.ts.map +1 -0
- package/dist/ui/ai-api.js +50 -0
- package/dist/ui/ai-client.d.ts +1 -0
- package/dist/ui/ai-client.d.ts.map +1 -0
- package/dist/ui/ai-client.js +438 -0
- package/dist/ui/api.d.ts +3 -0
- package/dist/ui/api.d.ts.map +1 -0
- package/dist/ui/api.js +680 -0
- package/dist/ui-web/assets/brand-icons-Cu_C0hZ4.svg +1008 -0
- package/dist/ui-web/assets/brand-icons-F3SPCeH1.woff +0 -0
- package/dist/ui-web/assets/brand-icons-XL9sxUpA.woff2 +0 -0
- package/dist/ui-web/assets/brand-icons-sqJ2Pg7a.eot +0 -0
- package/dist/ui-web/assets/brand-icons-ubhWoxly.ttf +0 -0
- package/dist/ui-web/assets/flags-DOLqOU7Y.png +0 -0
- package/dist/ui-web/assets/icons-BOCtAERH.woff +0 -0
- package/dist/ui-web/assets/icons-CHzK1VD9.eot +0 -0
- package/dist/ui-web/assets/icons-D29ZQHHw.ttf +0 -0
- package/dist/ui-web/assets/icons-Du6TOHnR.woff2 +0 -0
- package/dist/ui-web/assets/icons-RwhydX30.svg +1518 -0
- package/dist/ui-web/assets/index-CpaB9P6g.css +1 -0
- package/dist/ui-web/assets/index-J9MCfjCd.js +95 -0
- package/dist/ui-web/assets/outline-icons-BfdLr8tr.svg +366 -0
- package/dist/ui-web/assets/outline-icons-DD8jm0uy.ttf +0 -0
- package/dist/ui-web/assets/outline-icons-DInHoiqI.woff2 +0 -0
- package/dist/ui-web/assets/outline-icons-LX8adJ4n.eot +0 -0
- package/dist/ui-web/assets/outline-icons-aQ88nltS.woff +0 -0
- package/dist/ui-web/assets/provider-utils_false-BKJD46kk.js +1 -0
- package/dist/ui-web/assets/provider-utils_false-Bu5lmX18.js +1 -0
- package/dist/ui-web/index.html +13 -0
- package/dist/ui-web/vite.svg +1 -0
- package/dist/vector/embedding.d.ts.map +1 -1
- package/dist/vector/embedding.js +7 -7
- package/package.json +7 -5
- package/src/api/config.ts +0 -3
- package/src/api/sonamu.ts +17 -4
- package/src/bin/cli.ts +1 -67
- package/src/syncer/api-parser.ts +2 -1
- package/src/syncer/syncer.ts +20 -21
- package/src/ui/ai-api.ts +60 -0
- package/src/ui/ai-client.ts +499 -0
- package/src/ui/api.ts +786 -0
- package/src/vector/embedding.ts +8 -6
package/src/vector/embedding.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { OpenAIProvider } from "@ai-sdk/openai";
|
|
2
2
|
import { type EmbeddingModel, embedMany } from "ai";
|
|
3
|
-
import { VoyageAIClient } from "voyageai";
|
|
3
|
+
import type { VoyageAIClient } from "voyageai";
|
|
4
4
|
import { Sonamu } from "../api/sonamu";
|
|
5
5
|
import { DEFAULT_VECTOR_CONFIG } from "./config";
|
|
6
6
|
import type {
|
|
@@ -31,7 +31,8 @@ export class EmbeddingClass {
|
|
|
31
31
|
/**
|
|
32
32
|
* Voyage AI 클라이언트 초기화
|
|
33
33
|
*/
|
|
34
|
-
private getVoyageClient(): VoyageAIClient {
|
|
34
|
+
private async getVoyageClient(): Promise<VoyageAIClient> {
|
|
35
|
+
const { VoyageAIClient } = await import("voyageai");
|
|
35
36
|
const apiKey = Sonamu.secrets?.voyage_api_key ?? process.env.VOYAGE_API_KEY;
|
|
36
37
|
if (!apiKey) {
|
|
37
38
|
throw new Error("VOYAGE_API_KEY가 설정되지 않았습니다. 환경변수를 확인하세요.");
|
|
@@ -42,7 +43,8 @@ export class EmbeddingClass {
|
|
|
42
43
|
/**
|
|
43
44
|
* OpenAI provider 생성
|
|
44
45
|
*/
|
|
45
|
-
private getOpenAIProvider(): OpenAIProvider {
|
|
46
|
+
private async getOpenAIProvider(): Promise<OpenAIProvider> {
|
|
47
|
+
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
46
48
|
const apiKey = Sonamu.secrets?.openai_api_key ?? process.env.OPENAI_API_KEY;
|
|
47
49
|
if (!apiKey) {
|
|
48
50
|
throw new Error("OPENAI_API_KEY가 설정되지 않았습니다. 환경변수를 확인하세요.");
|
|
@@ -107,7 +109,7 @@ export class EmbeddingClass {
|
|
|
107
109
|
texts: string[],
|
|
108
110
|
inputType: VectorInputType,
|
|
109
111
|
): Promise<EmbeddingResult[]> {
|
|
110
|
-
const client = this.getVoyageClient();
|
|
112
|
+
const client = await this.getVoyageClient();
|
|
111
113
|
const voyageConfig = this.config.voyage;
|
|
112
114
|
|
|
113
115
|
const response = await client.embed({
|
|
@@ -130,7 +132,7 @@ export class EmbeddingClass {
|
|
|
130
132
|
* OpenAI 임베딩
|
|
131
133
|
*/
|
|
132
134
|
private async embedOpenAI(texts: string[]): Promise<EmbeddingResult[]> {
|
|
133
|
-
const openai = this.getOpenAIProvider();
|
|
135
|
+
const openai = await this.getOpenAIProvider();
|
|
134
136
|
const openaiConfig = this.config.openai;
|
|
135
137
|
const model = openai.embeddingModel(openaiConfig.model);
|
|
136
138
|
|