UNPKG

rawi

Version:

Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into

4 lines 3.37 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */ var _chunkYTPAJ6Q2cjs = require('./chunk-YTPAJ6Q2.cjs');var _deepseek = require('@ai-sdk/deepseek');var _ai = require('ai');var k=["deepseek-chat","deepseek-reasoner"],y= exports.b =k.map(e=>({name:e,displayName:e})),g= exports.c ={name:"deepseek",displayName:"\u{1F535} DeepSeek",models:y},h= exports.d =async(e,a)=>{try{let t=e.providerSettings,r=_optionalChain([t, 'optionalAccess', _ => _.apiKey])||e.apiKey;if(!e.apiKey)throw new Error("API key is required for DeepSeek");let s=_optionalChain([t, 'optionalAccess', _2 => _2.baseURL])||"https://api.deepseek.com/v1",p=_deepseek.createDeepSeek.call(void 0, {apiKey:r,baseURL:s}),o=_ai.streamText.call(void 0, {model:p(e.model),prompt:a,temperature:e.temperature||.7,maxOutputTokens:e.maxTokens||2048});return{textStream:o.textStream,fullResponse:o.text}}catch(t){throw new Error(`Error calling DeepSeek streaming API: ${t instanceof Error?t.message:String(t)}`)}},f= exports.e ={name:"deepseek",displayName:"\u{1F535} DeepSeek",async streamChat(e,a,t={}){let r=e.providerSettings||{},s=r.apiKey||e.apiKey,p=r.baseURL||"https://api.deepseek.com/v1";if(!s)throw new Error("API key is required for DeepSeek");let o=_deepseek.createDeepSeek.call(void 0, {apiKey:s,baseURL:p});return _ai.streamText.call(void 0, {model:o(e.model),messages:a,temperature:e.temperature||t.temperature||.7,maxOutputTokens:e.maxTokens||t.maxTokens||2048}).textStream}},D= exports.f =async e=>{let a=Date.now();try{let t=e.credentials.providerSettings,r=_optionalChain([t, 'optionalAccess', _3 => _3.apiKey])||e.credentials.apiKey;if(!r)throw new Error("API key is required for DeepSeek");let s=_optionalChain([t, 'optionalAccess', _4 => _4.baseURL])||"https://api.deepseek.com/v1",p=_deepseek.createDeepSeek.call(void 0, {apiKey:r,baseURL:s}),o=await _ai.generateText.call(void 0, {model:p(e.credentials.model),system:e.systemPrompt,prompt:e.userPrompt}),i=Date.now()-a;return{command:_chunkYTPAJ6Q2cjs.a.call(void 0, o.text),generationTime:i}}catch(t){throw new Error(`DeepSeek exec generation failed: ${t}`)}};exports.a = k; exports.b = y; exports.c = g; exports.d = h; exports.e = f; exports.f = D; /* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */ //# sourceMappingURL=chunk-HCZT2JRA.cjs.map