mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
stuck in svelte dev
This commit is contained in:
@@ -17,14 +17,18 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const handleChatRequest = async (c: Context) => {
|
||||
console.log("incoming request");
|
||||
const signal = c.req.raw.signal;
|
||||
let body: ChatRequestBodyType;
|
||||
|
||||
// Parse request body
|
||||
try {
|
||||
body = chatRequestBodySchema.parse(await c.req.json());
|
||||
const json = await c.req.json();
|
||||
// console.log("json", json);
|
||||
body = chatRequestBodySchema.parse(json);
|
||||
} catch (error) {
|
||||
if (error instanceof z.ZodError) {
|
||||
console.log("zod error", error);
|
||||
return c.json({ errors: error.issues }, 400);
|
||||
}
|
||||
|
||||
@@ -39,6 +43,8 @@ export const handleChatRequest = async (c: Context) => {
|
||||
return c.body(null, 200);
|
||||
}
|
||||
|
||||
console.log("body", body);
|
||||
|
||||
const artifactId = process.env.IMAGINE_ARTIFACT_ID!; // TODO: dynamically from body
|
||||
const projectId = process.env.IMAGINE_PROJECT_ID!; // TODO: dynamically from body
|
||||
|
||||
@@ -54,8 +60,6 @@ export const handleChatRequest = async (c: Context) => {
|
||||
const latestMessageTextPart = latestMessage.content[0] as TextPart;
|
||||
const restMessages = convertedMessages.slice(0, -1);
|
||||
|
||||
console.log("isNewConversation", isNewConversation);
|
||||
|
||||
// If it's a new conversation, we need to clone the workspace
|
||||
// This is temporary and will be handled by Synapse shortly!
|
||||
if (isNewConversation) {
|
||||
@@ -102,14 +106,10 @@ export const handleChatRequest = async (c: Context) => {
|
||||
type: 'start-step'
|
||||
});
|
||||
|
||||
console.log("BEFORE STREAM");
|
||||
|
||||
for await (const chunk of result.stream) {
|
||||
// We must await the stream
|
||||
}
|
||||
|
||||
console.log("AFTER STREAM");
|
||||
|
||||
writer.write({
|
||||
type: 'finish-step'
|
||||
});
|
||||
@@ -126,8 +126,6 @@ export const handleChatRequest = async (c: Context) => {
|
||||
|
||||
const { messages } = event;
|
||||
|
||||
console.log("Saving conversation", { conversationId });
|
||||
|
||||
await updateConversation({
|
||||
conversation: {
|
||||
...conversation,
|
||||
|
||||
@@ -49,10 +49,8 @@ const planStep = createStep({
|
||||
const artifactId = runtimeContext.get("artifactId") as string;
|
||||
console.log("artifactId", artifactId);
|
||||
const gitRepositoryUtils = new GitRepositoryUtils(artifactId);
|
||||
console.log("gitRepositoryUtils", gitRepositoryUtils);
|
||||
const existingFiles =
|
||||
await gitRepositoryUtils.listRepositoryFileStrucrture();
|
||||
console.log("existingFiles", existingFiles);
|
||||
const relevantFiles = getPagesAndComponents(existingFiles);
|
||||
const readonlyFiles = [
|
||||
...existingFiles.filter(
|
||||
|
||||
@@ -0,0 +1,698 @@
|
||||
import { AppwriteException } from '@appwrite.io/console';
|
||||
import type { Client, Payload } from '@appwrite.io/console';
|
||||
|
||||
export class Imagine {
|
||||
client: Client;
|
||||
|
||||
constructor(client: Client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all artifacts. This endpoint supports pagination and searching.
|
||||
*
|
||||
* @param {string[]} queries
|
||||
* @param {string} search
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<ArtifactsList>}
|
||||
*/
|
||||
list(queries?: string[], search?: string): Promise<ArtifactsList> {
|
||||
const apiPath = '/imagine/artifacts';
|
||||
const payload: Payload = {};
|
||||
if (typeof queries !== 'undefined') {
|
||||
payload['queries'] = queries;
|
||||
}
|
||||
if (typeof search !== 'undefined') {
|
||||
payload['search'] = search;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Create a new artifact. You can pass a custom ID or generate a random ID with `ID.unique()`.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Artifact>}
|
||||
*/
|
||||
create(artifactId: string): Promise<Artifact> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts';
|
||||
const payload: Payload = {};
|
||||
if (typeof artifactId !== 'undefined') {
|
||||
payload['artifactId'] = artifactId;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('post', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Get an artifact by its unique ID.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Artifact>}
|
||||
*/
|
||||
get(artifactId: string): Promise<Artifact> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}'.replace('{artifactId}', artifactId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Update an artifact name by its unique ID.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} name
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Artifact>}
|
||||
*/
|
||||
update(artifactId: string, name?: string): Promise<Artifact> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}'.replace('{artifactId}', artifactId);
|
||||
const payload: Payload = {};
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('patch', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Delete an artifact by its unique ID. Once deleted, the artifact will no longer be available
|
||||
and all associated resources will be removed.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<{}>}
|
||||
*/
|
||||
delete(artifactId: string): Promise<{}> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}'.replace('{artifactId}', artifactId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('delete', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* List all conversations for an artifact. This endpoint supports pagination and searching.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string[]} queries
|
||||
* @param {string} search
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<ConversationsList>}
|
||||
*/
|
||||
listConversations(
|
||||
artifactId: string,
|
||||
queries?: string[],
|
||||
search?: string
|
||||
): Promise<ConversationsList> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations'.replace(
|
||||
'{artifactId}',
|
||||
artifactId
|
||||
);
|
||||
const payload: Payload = {};
|
||||
if (typeof queries !== 'undefined') {
|
||||
payload['queries'] = queries;
|
||||
}
|
||||
if (typeof search !== 'undefined') {
|
||||
payload['search'] = search;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Create a new conversation for an artifact.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} name
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Conversation>}
|
||||
*/
|
||||
createConversation(artifactId: string, name: string): Promise<Conversation> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof name === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "name"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations'.replace(
|
||||
'{artifactId}',
|
||||
artifactId
|
||||
);
|
||||
const payload: Payload = {};
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('post', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Get a conversation by its unique ID.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Conversation>}
|
||||
*/
|
||||
getConversation(artifactId: string, conversationId: string): Promise<Conversation> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations/{conversationId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Update a conversation by its unique ID. This endpoint allows you to update the conversation's name,
|
||||
messages, and status.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {string} name
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Conversation>}
|
||||
*/
|
||||
updateConversation(
|
||||
artifactId: string,
|
||||
conversationId: string,
|
||||
name?: string
|
||||
): Promise<Conversation> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations/{conversationId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId);
|
||||
const payload: Payload = {};
|
||||
if (typeof name !== 'undefined') {
|
||||
payload['name'] = name;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('patch', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Delete a conversation by its unique ID. Once deleted, the conversation will no longer be available.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<{}>}
|
||||
*/
|
||||
deleteConversation(artifactId: string, conversationId: string): Promise<{}> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations/{conversationId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('delete', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* List all messages in a conversation. This endpoint supports pagination and searching.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {string[]} queries
|
||||
* @param {string} search
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<ConversationsMessagesList>}
|
||||
*/
|
||||
listMessages(
|
||||
artifactId: string,
|
||||
conversationId: string,
|
||||
queries?: string[],
|
||||
search?: string
|
||||
): Promise<ConversationsMessagesList> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations/{conversationId}/messages'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId);
|
||||
const payload: Payload = {};
|
||||
if (typeof queries !== 'undefined') {
|
||||
payload['queries'] = queries;
|
||||
}
|
||||
if (typeof search !== 'undefined') {
|
||||
payload['search'] = search;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Create a new message in a conversation.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {Type} type
|
||||
* @param {string} content
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
createMessage(
|
||||
artifactId: string,
|
||||
conversationId: string,
|
||||
type: Type,
|
||||
content: string
|
||||
): Promise<Message> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
if (typeof type === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "type"');
|
||||
}
|
||||
if (typeof content === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "content"');
|
||||
}
|
||||
const apiPath = '/imagine/artifacts/{artifactId}/conversations/{conversationId}/messages'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId);
|
||||
const payload: Payload = {};
|
||||
if (typeof type !== 'undefined') {
|
||||
payload['type'] = type;
|
||||
}
|
||||
if (typeof content !== 'undefined') {
|
||||
payload['content'] = content;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('post', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Get a message by its unique ID.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {string} messageId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<ConversationsMessage>}
|
||||
*/
|
||||
getMessage(
|
||||
artifactId: string,
|
||||
conversationId: string,
|
||||
messageId: string
|
||||
): Promise<ConversationsMessage> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
if (typeof messageId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "messageId"');
|
||||
}
|
||||
const apiPath =
|
||||
'/imagine/artifacts/{artifactId}/conversations/{conversationId}/messages/{messageId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId)
|
||||
.replace('{messageId}', messageId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('get', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Update a message by its unique ID. This endpoint allows you to update the message's content and type.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {string} messageId
|
||||
* @param {string} content
|
||||
* @param {string} type
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<ConversationsMessage>}
|
||||
*/
|
||||
updateMessage(
|
||||
artifactId: string,
|
||||
conversationId: string,
|
||||
messageId: string,
|
||||
content?: string,
|
||||
type?: string
|
||||
): Promise<ConversationsMessage> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
if (typeof messageId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "messageId"');
|
||||
}
|
||||
const apiPath =
|
||||
'/imagine/artifacts/{artifactId}/conversations/{conversationId}/messages/{messageId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId)
|
||||
.replace('{messageId}', messageId);
|
||||
const payload: Payload = {};
|
||||
if (typeof content !== 'undefined') {
|
||||
payload['content'] = content;
|
||||
}
|
||||
if (typeof type !== 'undefined') {
|
||||
payload['type'] = type;
|
||||
}
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('patch', uri, apiHeaders, payload);
|
||||
}
|
||||
/**
|
||||
* Delete a message by its unique ID. Once deleted, the message will no longer be available.
|
||||
*
|
||||
* @param {string} artifactId
|
||||
* @param {string} conversationId
|
||||
* @param {string} messageId
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise<{}>}
|
||||
*/
|
||||
deleteMessage(artifactId: string, conversationId: string, messageId: string): Promise<{}> {
|
||||
if (typeof artifactId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "artifactId"');
|
||||
}
|
||||
if (typeof conversationId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "conversationId"');
|
||||
}
|
||||
if (typeof messageId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "messageId"');
|
||||
}
|
||||
const apiPath =
|
||||
'/imagine/artifacts/{artifactId}/conversations/{conversationId}/messages/{messageId}'
|
||||
.replace('{artifactId}', artifactId)
|
||||
.replace('{conversationId}', conversationId)
|
||||
.replace('{messageId}', messageId);
|
||||
const payload: Payload = {};
|
||||
const uri = new URL(this.client.config.endpoint + apiPath);
|
||||
|
||||
const apiHeaders: { [header: string]: string } = {
|
||||
'content-type': 'application/json'
|
||||
};
|
||||
|
||||
return this.client.call('delete', uri, apiHeaders, payload);
|
||||
}
|
||||
}
|
||||
|
||||
export enum Type {
|
||||
Text = 'text',
|
||||
Image = 'image'
|
||||
}
|
||||
export type Artifact = {
|
||||
/**
|
||||
* Artifact unique ID.
|
||||
*/
|
||||
$id: string;
|
||||
/**
|
||||
* Artifact creation date in ISO 8601 format.
|
||||
*/
|
||||
$createdAt: string;
|
||||
/**
|
||||
* Artifact update date in ISO 8601 format.
|
||||
*/
|
||||
$updatedAt: string;
|
||||
/**
|
||||
* Artifact name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Artifact description.
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Artifact version.
|
||||
*/
|
||||
version?: string;
|
||||
/**
|
||||
* Framework used in the artifact.
|
||||
*/
|
||||
framework?: string;
|
||||
/**
|
||||
* Technology stack used in the artifact.
|
||||
*/
|
||||
stack?: string[];
|
||||
/**
|
||||
* Original prompt used to generate the artifact.
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* Current status of the artifact. Possible values: draft, processing, completed, failed.
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
/**
|
||||
* Conversation
|
||||
*/
|
||||
export type Conversation = {
|
||||
/**
|
||||
* Conversation unique ID.
|
||||
*/
|
||||
$id: string;
|
||||
/**
|
||||
* Conversation creation date in ISO 8601 format.
|
||||
*/
|
||||
$createdAt: string;
|
||||
/**
|
||||
* Conversation update date in ISO 8601 format.
|
||||
*/
|
||||
$updatedAt: string;
|
||||
/**
|
||||
* ID of the artifact this conversation belongs to.
|
||||
*/
|
||||
artifactId: string;
|
||||
/**
|
||||
* Conversation name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Search index string.
|
||||
*/
|
||||
search: string;
|
||||
};
|
||||
/**
|
||||
* ConversationsMessage
|
||||
*/
|
||||
export type ConversationsMessage = {
|
||||
/**
|
||||
* Message unique ID.
|
||||
*/
|
||||
$id: string;
|
||||
/**
|
||||
* Message creation date in ISO 8601 format.
|
||||
*/
|
||||
$createdAt: string;
|
||||
/**
|
||||
* Message update date in ISO 8601 format.
|
||||
*/
|
||||
$updatedAt: string;
|
||||
/**
|
||||
* Artifact unique ID.
|
||||
*/
|
||||
artifactId: string;
|
||||
/**
|
||||
* Conversation unique ID.
|
||||
*/
|
||||
conversationId: string;
|
||||
/**
|
||||
* Message type.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Message content.
|
||||
*/
|
||||
content: string;
|
||||
/**
|
||||
* Message role.
|
||||
*/
|
||||
role: string;
|
||||
};
|
||||
/**
|
||||
* Artifacts List
|
||||
*/
|
||||
export type ArtifactsList = {
|
||||
/**
|
||||
* Total number of artifacts documents that matched your query.
|
||||
*/
|
||||
total: number;
|
||||
/**
|
||||
* List of artifacts.
|
||||
*/
|
||||
artifacts: Artifact[];
|
||||
};
|
||||
/**
|
||||
* Conversations List
|
||||
*/
|
||||
export type ConversationsList = {
|
||||
/**
|
||||
* Total number of conversations documents that matched your query.
|
||||
*/
|
||||
total: number;
|
||||
/**
|
||||
* List of conversations.
|
||||
*/
|
||||
conversations: Conversation[];
|
||||
};
|
||||
/**
|
||||
* Conversations Messages List
|
||||
*/
|
||||
export type ConversationsMessagesList = {
|
||||
/**
|
||||
* Total number of messages documents that matched your query.
|
||||
*/
|
||||
total: number;
|
||||
/**
|
||||
* List of messages.
|
||||
*/
|
||||
messages: ConversationsMessage[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Message
|
||||
*/
|
||||
export type Message = {
|
||||
/**
|
||||
* Message ID.
|
||||
*/
|
||||
$id: string;
|
||||
/**
|
||||
* Message creation time in ISO 8601 format.
|
||||
*/
|
||||
$createdAt: string;
|
||||
/**
|
||||
* Message update date in ISO 8601 format.
|
||||
*/
|
||||
$updatedAt: string;
|
||||
/**
|
||||
* Message provider type.
|
||||
*/
|
||||
providerType: string;
|
||||
/**
|
||||
* Topic IDs set as recipients.
|
||||
*/
|
||||
topics: string[];
|
||||
/**
|
||||
* User IDs set as recipients.
|
||||
*/
|
||||
users: string[];
|
||||
/**
|
||||
* Target IDs set as recipients.
|
||||
*/
|
||||
targets: string[];
|
||||
/**
|
||||
* The scheduled time for message.
|
||||
*/
|
||||
scheduledAt?: string;
|
||||
/**
|
||||
* The time when the message was delivered.
|
||||
*/
|
||||
deliveredAt?: string;
|
||||
/**
|
||||
* Delivery errors if any.
|
||||
*/
|
||||
deliveryErrors?: string[];
|
||||
/**
|
||||
* Number of recipients the message was delivered to.
|
||||
*/
|
||||
deliveredTotal: number;
|
||||
/**
|
||||
* Data of the message.
|
||||
*/
|
||||
data: object;
|
||||
/**
|
||||
* Status of delivery.
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
"dev": "vite dev",
|
||||
"build": "node build.js",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
"prepare": "svelte-kit sync",
|
||||
"clean": "rm -rf node_modules && rm -rf .svelte_kit && pnpm i --force",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
@@ -21,7 +21,7 @@
|
||||
"e2e:ui": "playwright test --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^2.1.12",
|
||||
"@ai-sdk/svelte": "3.0.0-beta.19",
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1",
|
||||
@@ -30,7 +30,7 @@
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.38.0",
|
||||
"@stripe/stripe-js": "^3.5.0",
|
||||
"ai": "^2.2.37",
|
||||
"ai": "5.0.0-beta.10",
|
||||
"analytics": "^0.8.16",
|
||||
"cron-parser": "^4.9.0",
|
||||
"dayjs": "^1.11.13",
|
||||
|
||||
Generated
+94
-289
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@ai-sdk/svelte':
|
||||
specifier: ^2.1.12
|
||||
version: 2.1.12(svelte@5.25.3)(zod@3.25.67)
|
||||
specifier: 3.0.0-beta.19
|
||||
version: 3.0.0-beta.19(svelte@5.25.3)(zod@3.25.67)
|
||||
'@appwrite.io/console':
|
||||
specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564
|
||||
version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564
|
||||
@@ -36,8 +36,8 @@ importers:
|
||||
specifier: ^3.5.0
|
||||
version: 3.5.0
|
||||
ai:
|
||||
specifier: ^2.2.37
|
||||
version: 2.2.37(react@18.3.1)(solid-js@1.9.5)(svelte@5.25.3)(vue@3.5.13(typescript@5.8.2))
|
||||
specifier: 5.0.0-beta.10
|
||||
version: 5.0.0-beta.10(zod@3.25.67)
|
||||
analytics:
|
||||
specifier: ^0.8.16
|
||||
version: 0.8.16(@types/dlv@1.1.5)
|
||||
@@ -219,31 +219,43 @@ packages:
|
||||
'@adobe/css-tools@4.4.2':
|
||||
resolution: {integrity: sha512-baYZExFpsdkBNuvGKTKWCwKH57HRZLVtycZS05WTQNVOiXVSeAki3nU35zlRbToeMW8aHlJfyS+1C4BOv27q0A==}
|
||||
|
||||
'@ai-sdk/provider-utils@2.2.8':
|
||||
resolution: {integrity: sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA==}
|
||||
'@ai-sdk/gateway@1.0.0-beta.4':
|
||||
resolution: {integrity: sha512-P5/dS7pb+cBRWnTP0Aezq3/3PIrF+p64fUTxBAyZIert8qTyHm2gd6atbAJZprZ304Ui3QjA9MFybAa849//2w==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
zod: ^3.23.8
|
||||
zod: ^3.25.49
|
||||
|
||||
'@ai-sdk/provider@1.1.3':
|
||||
resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
|
||||
'@ai-sdk/gateway@1.0.0-beta.8':
|
||||
resolution: {integrity: sha512-D2SqYRT/42JTiRxUuiWtn5cYQFscpb9Z14UNvJx7lnurBUXx57zy7TbLH0h7O+WbCluTQN5G6146JpUZ/SRyzw==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
zod: ^3.25.49 || ^4
|
||||
|
||||
'@ai-sdk/provider-utils@3.0.0-beta.2':
|
||||
resolution: {integrity: sha512-H4K+4weOVgWqrDDeAbQWoA4U5mN4WrQPHQFdH7ynQYcnhj/pzctU9Q6mGlR5ESMWxaXxazxlOblSITlXo9bahA==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
zod: ^3.25.49
|
||||
|
||||
'@ai-sdk/provider-utils@3.0.0-beta.3':
|
||||
resolution: {integrity: sha512-4gZ392GxjzMF7TnReF2eTKhOSyiSS3ydRVq4I7jxkeV5sdEuMoH3gzfItmlctsqGxlMU1/+zKPwl5yYz9O2dzg==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
zod: ^3.25.49 || ^4
|
||||
|
||||
'@ai-sdk/provider@2.0.0-beta.1':
|
||||
resolution: {integrity: sha512-Z8SPncMtS3RsoXITmT7NVwrAq6M44dmw0DoUOYJqNNtCu8iMWuxB8Nxsoqpa0uEEy9R1V1ZThJAXTYgjTUxl3w==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@ai-sdk/svelte@2.1.12':
|
||||
resolution: {integrity: sha512-1N0rRuMTIUR7m4z4Lq0SYVdtK+KPPivwmG0vb7Wu+P8YOy+dNgCuyiQtbHP0NAfdv06BMsdv5ByalHNhXM9kEA==}
|
||||
'@ai-sdk/svelte@3.0.0-beta.19':
|
||||
resolution: {integrity: sha512-ga3ZItXUT+sBxMyvlFIc9JnGUfcP0RuW2vE1TVWbTOGnPUhqPmHCoWhMyIR0Zc5y8dyItJpCHEn78bINSYMMQA==}
|
||||
peerDependencies:
|
||||
svelte: ^5.0.0
|
||||
zod: ^3.23.8
|
||||
svelte: ^5.31.0
|
||||
zod: ^3.25.49 || ^4
|
||||
peerDependenciesMeta:
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
'@ai-sdk/ui-utils@1.2.11':
|
||||
resolution: {integrity: sha512-3zcwCc8ezzFlwp3ZD15wAPjf2Au4s3vAbKsXQVyhxODHcmu0iyPO2Eua6D/vicq/AUm/BAo60r97O6HU+EI0+w==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
zod: ^3.23.8
|
||||
|
||||
'@ampproject/remapping@2.3.0':
|
||||
resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
@@ -1237,6 +1249,9 @@ packages:
|
||||
'@shikijs/vscode-textmate@10.0.2':
|
||||
resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}
|
||||
|
||||
'@standard-schema/spec@1.0.0':
|
||||
resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==}
|
||||
|
||||
'@stripe/stripe-js@3.5.0':
|
||||
resolution: {integrity: sha512-pKS3wZnJoL1iTyGBXAvCwduNNeghJHY6QSRSNNvpYnrrQrLZ6Owsazjyynu0e0ObRgks0i7Rv+pe2M7/MBTZpQ==}
|
||||
engines: {node: '>=12.16'}
|
||||
@@ -1505,35 +1520,6 @@ packages:
|
||||
'@vitest/utils@3.0.9':
|
||||
resolution: {integrity: sha512-ilHM5fHhZ89MCp5aAaM9uhfl1c2JdxVxl3McqsdVyVNN6JffnEen8UMCdRTzOhGXNQGo5GNL9QugHrz727Wnng==}
|
||||
|
||||
'@vue/compiler-core@3.5.13':
|
||||
resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==}
|
||||
|
||||
'@vue/compiler-dom@3.5.13':
|
||||
resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==}
|
||||
|
||||
'@vue/compiler-sfc@3.5.13':
|
||||
resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==}
|
||||
|
||||
'@vue/compiler-ssr@3.5.13':
|
||||
resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==}
|
||||
|
||||
'@vue/reactivity@3.5.13':
|
||||
resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==}
|
||||
|
||||
'@vue/runtime-core@3.5.13':
|
||||
resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==}
|
||||
|
||||
'@vue/runtime-dom@3.5.13':
|
||||
resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==}
|
||||
|
||||
'@vue/server-renderer@3.5.13':
|
||||
resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==}
|
||||
peerDependencies:
|
||||
vue: 3.5.13
|
||||
|
||||
'@vue/shared@3.5.13':
|
||||
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
|
||||
|
||||
'@xterm/addon-fit@0.10.0':
|
||||
resolution: {integrity: sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==}
|
||||
peerDependencies:
|
||||
@@ -1565,23 +1551,18 @@ packages:
|
||||
resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
ai@2.2.37:
|
||||
resolution: {integrity: sha512-JIYm5N1muGVqBqWnvkt29FmXhESoO5TcDxw74OE41SsM+uIou6NPDDs0XWb/ABcd1gmp6k5zym64KWMPM2xm0A==}
|
||||
engines: {node: '>=14.6'}
|
||||
ai@5.0.0-beta.10:
|
||||
resolution: {integrity: sha512-99NBfy2yqN/XkomQ24X1wIb0m7IjHUW3/4W7cskq3cxRjHrdSt3apfn7ao6tXwBXD+6hro9qar7AQhhaQ6n8yw==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
react: ^18.2.0
|
||||
solid-js: ^1.7.7
|
||||
svelte: ^3.0.0 || ^4.0.0
|
||||
vue: ^3.3.4
|
||||
peerDependenciesMeta:
|
||||
react:
|
||||
optional: true
|
||||
solid-js:
|
||||
optional: true
|
||||
svelte:
|
||||
optional: true
|
||||
vue:
|
||||
optional: true
|
||||
zod: ^3.25.49
|
||||
|
||||
ai@5.0.0-beta.19:
|
||||
resolution: {integrity: sha512-oBBQMUUZde/p4FlYdxteh5LCq6v8XQnD4oujHZ3OvwCbLDP/t9VYBq/fx8HKQ48AcKU2uTkvSy3q697SfajAbw==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
zod: ^3.25.49 || ^4
|
||||
|
||||
ajv@6.12.6:
|
||||
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
||||
@@ -2151,9 +2132,6 @@ packages:
|
||||
resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
estree-walker@2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
estree-walker@3.0.3:
|
||||
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
|
||||
|
||||
@@ -2161,9 +2139,9 @@ packages:
|
||||
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
eventsource-parser@1.0.0:
|
||||
resolution: {integrity: sha512-9jgfSCa3dmEme2ES3mPByGXfgZ87VbP97tng1G2nWwWx6bV2nYxm2AWCrbQjXToSe+yYlqaZNtxffR9IeQr95g==}
|
||||
engines: {node: '>=14.18'}
|
||||
eventsource-parser@3.0.3:
|
||||
resolution: {integrity: sha512-nVpZkTMM9rF6AQ9gPJpFsNAMt48wIzB5TQgiTLdHiuO8XEDhUgZEhqKlZWXbIzo9VmJ/HvysHqEaVeD5v9TPvA==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
expect-type@1.2.0:
|
||||
resolution: {integrity: sha512-80F22aiJ3GLyVnS/B3HzgR6RelZVumzj9jkL0Rhz4h0xYbNW9PjlQz5h3J/SShErbXBc295vseR4/MIbVmUbeA==}
|
||||
@@ -2577,10 +2555,6 @@ packages:
|
||||
longest-streak@3.1.0:
|
||||
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
|
||||
|
||||
loose-envify@1.4.0:
|
||||
resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
|
||||
hasBin: true
|
||||
|
||||
loupe@3.1.3:
|
||||
resolution: {integrity: sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==}
|
||||
|
||||
@@ -2809,11 +2783,6 @@ packages:
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
nanoid@3.3.6:
|
||||
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
nanoid@5.1.5:
|
||||
resolution: {integrity: sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw==}
|
||||
engines: {node: ^18 || >=20}
|
||||
@@ -3048,10 +3017,6 @@ packages:
|
||||
react-is@17.0.2:
|
||||
resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}
|
||||
|
||||
react@18.3.1:
|
||||
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
readdirp@3.6.0:
|
||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||
engines: {node: '>=8.10.0'}
|
||||
@@ -3158,9 +3123,6 @@ packages:
|
||||
resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
|
||||
engines: {node: '>=v12.22.7'}
|
||||
|
||||
secure-json-parse@2.7.0:
|
||||
resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
|
||||
|
||||
semver@6.3.1:
|
||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||
hasBin: true
|
||||
@@ -3170,16 +3132,6 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
seroval-plugins@1.2.1:
|
||||
resolution: {integrity: sha512-H5vs53+39+x4Udwp4J5rNZfgFuA+Lt+uU+09w1gYBVWomtAl98B+E9w7yC05Xc81/HgLvJdlyqJbU0fJCKCmdw==}
|
||||
engines: {node: '>=10'}
|
||||
peerDependencies:
|
||||
seroval: ^1.0
|
||||
|
||||
seroval@1.2.1:
|
||||
resolution: {integrity: sha512-yBxFFs3zmkvKNmR0pFSU//rIsYjuX418TnlDmc2weaq5XFDqDIV/NOMPBoLrbxjLH42p4UzRuXHryXh9dYcKcw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
set-cookie-parser@2.7.1:
|
||||
resolution: {integrity: sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==}
|
||||
|
||||
@@ -3228,16 +3180,6 @@ packages:
|
||||
resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
solid-js@1.9.5:
|
||||
resolution: {integrity: sha512-ogI3DaFcyn6UhYhrgcyRAMbu/buBJitYQASZz5WzfQVPP10RD2AbCoRZ517psnezrasyCbWzIxZ6kVqet768xw==}
|
||||
|
||||
solid-swr-store@0.10.7:
|
||||
resolution: {integrity: sha512-A6d68aJmRP471aWqKKPE2tpgOiR5fH4qXQNfKIec+Vap+MGQm3tvXlT8n0I8UgJSlNAsSAUuw2VTviH2h3Vv5g==}
|
||||
engines: {node: '>=10'}
|
||||
peerDependencies:
|
||||
solid-js: ^1.2
|
||||
swr-store: ^0.10
|
||||
|
||||
sorcery@1.0.0:
|
||||
resolution: {integrity: sha512-5ay9oJE+7sNmhzl3YNG18jEEEf4AOQCM/FAqR5wMmzqd1FtRorFbJXn3w3SKOhbiQaVgHM+Q1lszZspjri7bpA==}
|
||||
hasBin: true
|
||||
@@ -3256,11 +3198,6 @@ packages:
|
||||
sprintf-js@1.0.3:
|
||||
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
|
||||
|
||||
sswr@2.0.0:
|
||||
resolution: {integrity: sha512-mV0kkeBHcjcb0M5NqKtKVg/uTIYNlIIniyDfSGrSfxpEdM9C365jK0z55pl9K0xAkNTJi2OAOVFQpgMPUk+V0w==}
|
||||
peerDependencies:
|
||||
svelte: ^4.0.0
|
||||
|
||||
stackback@0.0.2:
|
||||
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
|
||||
|
||||
@@ -3379,23 +3316,6 @@ packages:
|
||||
resolution: {integrity: sha512-J9rcZ/xVJonAoESqVGHHZhrNdVbrCfkdB41BP6eiwHMoFShD9it3yZXApVYMHdGfCshBsZCKsajwJeBbS/M1zg==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
swr-store@0.10.6:
|
||||
resolution: {integrity: sha512-xPjB1hARSiRaNNlUQvWSVrG5SirCjk2TmaUyzzvk69SZQan9hCJqw/5rG9iL7xElHU784GxRPISClq4488/XVw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
swr@2.2.0:
|
||||
resolution: {integrity: sha512-AjqHOv2lAhkuUdIiBu9xbuettzAzWXmCEcLONNKJRba87WAefz8Ca9d6ds/SzrPc235n1IxWYdhJ2zF3MNUaoQ==}
|
||||
peerDependencies:
|
||||
react: ^16.11.0 || ^17.0.0 || ^18.0.0
|
||||
|
||||
swrev@4.0.0:
|
||||
resolution: {integrity: sha512-LqVcOHSB4cPGgitD1riJ1Hh4vdmITOp+BkmfmXRh4hSF/t7EnS4iD+SOTmq7w5pPm/SiPeto4ADbKS6dHUDWFA==}
|
||||
|
||||
swrv@1.0.4:
|
||||
resolution: {integrity: sha512-zjEkcP8Ywmj+xOJW3lIT65ciY/4AL4e/Or7Gj0MzU3zBJNMdJiT8geVZhINavnlHRMMCcJLHhraLTAiDOTmQ9g==}
|
||||
peerDependencies:
|
||||
vue: '>=3.2.26 < 4'
|
||||
|
||||
symbol-tree@3.2.4:
|
||||
resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
|
||||
|
||||
@@ -3545,11 +3465,6 @@ packages:
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
use-sync-external-store@1.5.0:
|
||||
resolution: {integrity: sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==}
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
|
||||
util-deprecate@1.0.2:
|
||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||
|
||||
@@ -3640,14 +3555,6 @@ packages:
|
||||
jsdom:
|
||||
optional: true
|
||||
|
||||
vue@3.5.13:
|
||||
resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
w3c-xmlserializer@5.0.0:
|
||||
resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -3762,32 +3669,46 @@ snapshots:
|
||||
|
||||
'@adobe/css-tools@4.4.2': {}
|
||||
|
||||
'@ai-sdk/provider-utils@2.2.8(zod@3.25.67)':
|
||||
'@ai-sdk/gateway@1.0.0-beta.4(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 1.1.3
|
||||
nanoid: 3.3.11
|
||||
secure-json-parse: 2.7.0
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.67)
|
||||
zod: 3.25.67
|
||||
|
||||
'@ai-sdk/provider@1.1.3':
|
||||
'@ai-sdk/gateway@1.0.0-beta.8(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@ai-sdk/provider-utils': 3.0.0-beta.3(zod@3.25.67)
|
||||
zod: 3.25.67
|
||||
|
||||
'@ai-sdk/provider-utils@3.0.0-beta.2(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@standard-schema/spec': 1.0.0
|
||||
eventsource-parser: 3.0.3
|
||||
zod: 3.25.67
|
||||
zod-to-json-schema: 3.24.6(zod@3.25.67)
|
||||
|
||||
'@ai-sdk/provider-utils@3.0.0-beta.3(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@standard-schema/spec': 1.0.0
|
||||
eventsource-parser: 3.0.3
|
||||
zod: 3.25.67
|
||||
zod-to-json-schema: 3.24.6(zod@3.25.67)
|
||||
|
||||
'@ai-sdk/provider@2.0.0-beta.1':
|
||||
dependencies:
|
||||
json-schema: 0.4.0
|
||||
|
||||
'@ai-sdk/svelte@2.1.12(svelte@5.25.3)(zod@3.25.67)':
|
||||
'@ai-sdk/svelte@3.0.0-beta.19(svelte@5.25.3)(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider-utils': 2.2.8(zod@3.25.67)
|
||||
'@ai-sdk/ui-utils': 1.2.11(zod@3.25.67)
|
||||
'@ai-sdk/provider-utils': 3.0.0-beta.3(zod@3.25.67)
|
||||
ai: 5.0.0-beta.19(zod@3.25.67)
|
||||
svelte: 5.25.3
|
||||
optionalDependencies:
|
||||
zod: 3.25.67
|
||||
|
||||
'@ai-sdk/ui-utils@1.2.11(zod@3.25.67)':
|
||||
dependencies:
|
||||
'@ai-sdk/provider': 1.1.3
|
||||
'@ai-sdk/provider-utils': 2.2.8(zod@3.25.67)
|
||||
zod: 3.25.67
|
||||
zod-to-json-schema: 3.24.6(zod@3.25.67)
|
||||
|
||||
'@ampproject/remapping@2.3.0':
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.8
|
||||
@@ -4849,6 +4770,8 @@ snapshots:
|
||||
|
||||
'@shikijs/vscode-textmate@10.0.2': {}
|
||||
|
||||
'@standard-schema/spec@1.0.0': {}
|
||||
|
||||
'@stripe/stripe-js@3.5.0': {}
|
||||
|
||||
'@sveltejs/acorn-typescript@1.0.5(acorn@8.14.1)':
|
||||
@@ -5211,60 +5134,6 @@ snapshots:
|
||||
loupe: 3.1.3
|
||||
tinyrainbow: 2.0.0
|
||||
|
||||
'@vue/compiler-core@3.5.13':
|
||||
dependencies:
|
||||
'@babel/parser': 7.27.0
|
||||
'@vue/shared': 3.5.13
|
||||
entities: 4.5.0
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-dom@3.5.13':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
|
||||
'@vue/compiler-sfc@3.5.13':
|
||||
dependencies:
|
||||
'@babel/parser': 7.27.0
|
||||
'@vue/compiler-core': 3.5.13
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/compiler-ssr': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.17
|
||||
postcss: 8.5.3
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-ssr@3.5.13':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
|
||||
'@vue/reactivity@3.5.13':
|
||||
dependencies:
|
||||
'@vue/shared': 3.5.13
|
||||
|
||||
'@vue/runtime-core@3.5.13':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
|
||||
'@vue/runtime-dom@3.5.13':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.13
|
||||
'@vue/runtime-core': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
csstype: 3.1.3
|
||||
|
||||
'@vue/server-renderer@3.5.13(vue@3.5.13(typescript@5.8.2))':
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.5.13
|
||||
'@vue/shared': 3.5.13
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
'@vue/shared@3.5.13': {}
|
||||
|
||||
'@xterm/addon-fit@0.10.0(@xterm/xterm@5.5.0)':
|
||||
dependencies:
|
||||
'@xterm/xterm': 5.5.0
|
||||
@@ -5289,20 +5158,21 @@ snapshots:
|
||||
|
||||
agent-base@7.1.3: {}
|
||||
|
||||
ai@2.2.37(react@18.3.1)(solid-js@1.9.5)(svelte@5.25.3)(vue@3.5.13(typescript@5.8.2)):
|
||||
ai@5.0.0-beta.10(zod@3.25.67):
|
||||
dependencies:
|
||||
eventsource-parser: 1.0.0
|
||||
nanoid: 3.3.6
|
||||
solid-swr-store: 0.10.7(solid-js@1.9.5)(swr-store@0.10.6)
|
||||
sswr: 2.0.0(svelte@5.25.3)
|
||||
swr: 2.2.0(react@18.3.1)
|
||||
swr-store: 0.10.6
|
||||
swrv: 1.0.4(vue@3.5.13(typescript@5.8.2))
|
||||
optionalDependencies:
|
||||
react: 18.3.1
|
||||
solid-js: 1.9.5
|
||||
svelte: 5.25.3
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
'@ai-sdk/gateway': 1.0.0-beta.4(zod@3.25.67)
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.67)
|
||||
'@opentelemetry/api': 1.9.0
|
||||
zod: 3.25.67
|
||||
|
||||
ai@5.0.0-beta.19(zod@3.25.67):
|
||||
dependencies:
|
||||
'@ai-sdk/gateway': 1.0.0-beta.8(zod@3.25.67)
|
||||
'@ai-sdk/provider': 2.0.0-beta.1
|
||||
'@ai-sdk/provider-utils': 3.0.0-beta.3(zod@3.25.67)
|
||||
'@opentelemetry/api': 1.9.0
|
||||
zod: 3.25.67
|
||||
|
||||
ajv@6.12.6:
|
||||
dependencies:
|
||||
@@ -5953,15 +5823,13 @@ snapshots:
|
||||
|
||||
estraverse@5.3.0: {}
|
||||
|
||||
estree-walker@2.0.2: {}
|
||||
|
||||
estree-walker@3.0.3:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.7
|
||||
|
||||
esutils@2.0.3: {}
|
||||
|
||||
eventsource-parser@1.0.0: {}
|
||||
eventsource-parser@3.0.3: {}
|
||||
|
||||
expect-type@1.2.0: {}
|
||||
|
||||
@@ -6375,10 +6243,6 @@ snapshots:
|
||||
|
||||
longest-streak@3.1.0: {}
|
||||
|
||||
loose-envify@1.4.0:
|
||||
dependencies:
|
||||
js-tokens: 4.0.0
|
||||
|
||||
loupe@3.1.3: {}
|
||||
|
||||
lowlight@3.3.0:
|
||||
@@ -6771,8 +6635,6 @@ snapshots:
|
||||
|
||||
nanoid@3.3.11: {}
|
||||
|
||||
nanoid@3.3.6: {}
|
||||
|
||||
nanoid@5.1.5: {}
|
||||
|
||||
nanotar@0.1.1: {}
|
||||
@@ -6966,10 +6828,6 @@ snapshots:
|
||||
|
||||
react-is@17.0.2: {}
|
||||
|
||||
react@18.3.1:
|
||||
dependencies:
|
||||
loose-envify: 1.4.0
|
||||
|
||||
readdirp@3.6.0:
|
||||
dependencies:
|
||||
picomatch: 2.3.1
|
||||
@@ -7136,18 +6994,10 @@ snapshots:
|
||||
dependencies:
|
||||
xmlchars: 2.2.0
|
||||
|
||||
secure-json-parse@2.7.0: {}
|
||||
|
||||
semver@6.3.1: {}
|
||||
|
||||
semver@7.7.1: {}
|
||||
|
||||
seroval-plugins@1.2.1(seroval@1.2.1):
|
||||
dependencies:
|
||||
seroval: 1.2.1
|
||||
|
||||
seroval@1.2.1: {}
|
||||
|
||||
set-cookie-parser@2.7.1: {}
|
||||
|
||||
set-function-length@1.2.2:
|
||||
@@ -7221,17 +7071,6 @@ snapshots:
|
||||
mrmime: 2.0.1
|
||||
totalist: 3.0.1
|
||||
|
||||
solid-js@1.9.5:
|
||||
dependencies:
|
||||
csstype: 3.1.3
|
||||
seroval: 1.2.1
|
||||
seroval-plugins: 1.2.1(seroval@1.2.1)
|
||||
|
||||
solid-swr-store@0.10.7(solid-js@1.9.5)(swr-store@0.10.6):
|
||||
dependencies:
|
||||
solid-js: 1.9.5
|
||||
swr-store: 0.10.6
|
||||
|
||||
sorcery@1.0.0:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.0
|
||||
@@ -7246,11 +7085,6 @@ snapshots:
|
||||
|
||||
sprintf-js@1.0.3: {}
|
||||
|
||||
sswr@2.0.0(svelte@5.25.3):
|
||||
dependencies:
|
||||
svelte: 5.25.3
|
||||
swrev: 4.0.0
|
||||
|
||||
stackback@0.0.2: {}
|
||||
|
||||
std-env@3.8.1: {}
|
||||
@@ -7381,21 +7215,6 @@ snapshots:
|
||||
magic-string: 0.30.17
|
||||
zimmerframe: 1.1.2
|
||||
|
||||
swr-store@0.10.6:
|
||||
dependencies:
|
||||
dequal: 2.0.3
|
||||
|
||||
swr@2.2.0(react@18.3.1):
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
use-sync-external-store: 1.5.0(react@18.3.1)
|
||||
|
||||
swrev@4.0.0: {}
|
||||
|
||||
swrv@1.0.4(vue@3.5.13(typescript@5.8.2)):
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
symbol-tree@3.2.4: {}
|
||||
|
||||
tabbable@6.2.0: {}
|
||||
@@ -7545,10 +7364,6 @@ snapshots:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
||||
use-sync-external-store@1.5.0(react@18.3.1):
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
|
||||
util-deprecate@1.0.2: {}
|
||||
|
||||
vfile-message@4.0.2:
|
||||
@@ -7637,16 +7452,6 @@ snapshots:
|
||||
- tsx
|
||||
- yaml
|
||||
|
||||
vue@3.5.13(typescript@5.8.2):
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.13
|
||||
'@vue/compiler-sfc': 3.5.13
|
||||
'@vue/runtime-dom': 3.5.13
|
||||
'@vue/server-renderer': 3.5.13(vue@3.5.13(typescript@5.8.2))
|
||||
'@vue/shared': 3.5.13
|
||||
optionalDependencies:
|
||||
typescript: 5.8.2
|
||||
|
||||
w3c-xmlserializer@5.0.0:
|
||||
dependencies:
|
||||
xml-name-validator: 5.0.0
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { AvatarInitials, Code, LoadingDots, SvgIcon } from '$lib/components';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { useCompletion } from '@ai-sdk/svelte';
|
||||
import { Completion } from '@ai-sdk/svelte';
|
||||
import { subPanels } from '../subPanels';
|
||||
|
||||
import { isLanguage, type Language } from '$lib/components/code.svelte';
|
||||
@@ -15,14 +15,16 @@
|
||||
import { getApiEndpoint } from '$lib/stores/sdk';
|
||||
|
||||
const endpoint = getApiEndpoint();
|
||||
const { input, handleSubmit, completion, isLoading, complete, error } = useCompletion({
|
||||
|
||||
const completion = new Completion({
|
||||
api: endpoint + '/console/assistant',
|
||||
headers: {
|
||||
'x-appwrite-project': 'console'
|
||||
},
|
||||
credentials: 'include',
|
||||
streamProtocol: 'text'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
const examples = [
|
||||
'How to add platform in the console?',
|
||||
@@ -88,7 +90,7 @@
|
||||
return answer;
|
||||
}
|
||||
|
||||
$: answer = parseCompletion($completion);
|
||||
$: answer = parseCompletion(completion.completion);
|
||||
|
||||
function renderMarkdown(answer: string): string {
|
||||
const trimmedAnswer = answer
|
||||
@@ -123,25 +125,25 @@
|
||||
}
|
||||
|
||||
let previousQuestion = '';
|
||||
$: if ($input) {
|
||||
previousQuestion = $input;
|
||||
$: if (completion.input) {
|
||||
previousQuestion = completion.input;
|
||||
}
|
||||
|
||||
$: if (!$isLoading && answer) {
|
||||
$: if (!completion.loading && answer) {
|
||||
// reset input if answer received.
|
||||
$input = '';
|
||||
completion.input = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<Template
|
||||
options={$isLoading || answer
|
||||
options={completion.loading || answer
|
||||
? undefined
|
||||
: examples.map((e) => {
|
||||
return {
|
||||
label: e,
|
||||
callback: () => {
|
||||
$input = e;
|
||||
complete($input);
|
||||
completion.input = e;
|
||||
completion.complete(e);
|
||||
},
|
||||
group: 'Examples'
|
||||
};
|
||||
@@ -174,7 +176,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $isLoading || answer}
|
||||
{#if completion.loading || answer}
|
||||
<div class="content">
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<div class="avatar is-size-x-small">{getInitials($user.name || $user.email)}</div>
|
||||
@@ -185,7 +187,7 @@
|
||||
<SvgIcon name="sparkles" type="color" />
|
||||
</div>
|
||||
<div class="answer">
|
||||
{#if $isLoading && !$completion}
|
||||
{#if completion.loading && !completion.completion}
|
||||
<LoadingDots />
|
||||
{:else}
|
||||
{#each answer as part}
|
||||
@@ -213,7 +215,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $error}
|
||||
{#if completion.error}
|
||||
<div style="padding: 1rem; padding-block-end: 0;">
|
||||
<Alert.Inline status="error" title="Something went wrong">
|
||||
An unexpected error occurred while handling your request. Please try again later.
|
||||
@@ -232,7 +234,7 @@
|
||||
style:width="100%"
|
||||
style:align-items="center"
|
||||
on:submit|preventDefault={(e) => {
|
||||
handleSubmit(e);
|
||||
completion.handleSubmit(e);
|
||||
}}>
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<input
|
||||
@@ -241,14 +243,14 @@
|
||||
style:width="100%"
|
||||
placeholder="Ask a question..."
|
||||
autofocus
|
||||
bind:value={$input}
|
||||
disabled={$isLoading} />
|
||||
bind:value={completion.input}
|
||||
disabled={completion.loading} />
|
||||
<div class="options-list">
|
||||
<button
|
||||
class="options-list-button"
|
||||
aria-label="ask AI"
|
||||
type="submit"
|
||||
disabled={!$input.trim() || $isLoading}>
|
||||
disabled={!completion.input.trim() || completion.loading}>
|
||||
<span class="icon-arrow-sm-right" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Chat } from '@ai-sdk/svelte';
|
||||
import { Divider, Typography, Layout, Button, Icon } from '@appwrite.io/pink-svelte';
|
||||
import {
|
||||
IconArrowUp,
|
||||
@@ -9,15 +10,14 @@
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import Conversation from './conversation.svelte';
|
||||
import { conversation, showChat } from '$lib/stores/chat';
|
||||
import type { StreamParser } from './parser';
|
||||
import type { EventHandler } from 'svelte/elements';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { page } from '$app/state';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { studio } from '../studio.svelte';
|
||||
import UpgradePrompt from '$routes/(console)/project-[region]-[project]/studio/artifact-[artifact]/upgradePrompt.svelte';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { conversation, showChat } from '$lib/stores/chat';
|
||||
import { DefaultChatTransport } from 'ai';
|
||||
|
||||
type Props = {
|
||||
width: number;
|
||||
@@ -32,6 +32,31 @@
|
||||
|
||||
let chatTextareaRef: HTMLTextAreaElement | null = $state(null);
|
||||
|
||||
const chatBody: {
|
||||
token: string | null;
|
||||
projectId: string;
|
||||
artifactId: string | null;
|
||||
conversationId: string | null;
|
||||
} = {
|
||||
token: null,
|
||||
projectId: page.params.project,
|
||||
artifactId: null,
|
||||
conversationId: null
|
||||
};
|
||||
|
||||
const chat = new Chat({
|
||||
transport: new DefaultChatTransport({
|
||||
api: 'http://localhost:8889/api/chat',
|
||||
// body: chatBody
|
||||
})
|
||||
});
|
||||
// const chat = new Chat({
|
||||
// transport: new DefaultChatTransport({
|
||||
// api: 'http://localhost:8889/api/chat',
|
||||
// body: chatBody
|
||||
// })
|
||||
// });
|
||||
|
||||
const onkeydown: EventHandler<KeyboardEvent, HTMLTextAreaElement> = (event) => {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.shiftKey) return;
|
||||
@@ -42,8 +67,9 @@
|
||||
const onsubmit: EventHandler<SubmitEvent, HTMLFormElement> = (event) => {
|
||||
event.preventDefault();
|
||||
tokens = tokens - 1;
|
||||
if (studio.streaming) controller.abort();
|
||||
else createMessage();
|
||||
// if (studio.streaming) controller.abort();
|
||||
// else createMessage();
|
||||
createMessage();
|
||||
};
|
||||
|
||||
$effect(() => {
|
||||
@@ -53,74 +79,114 @@
|
||||
}
|
||||
});
|
||||
|
||||
let controller: AbortController;
|
||||
async function refreshToken() {
|
||||
// const token = await sdk.forConsoleIn(page.params.region).account.createJWT();
|
||||
const token = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.account.createJWT();
|
||||
chatBody.token = token.jwt;
|
||||
}
|
||||
|
||||
// let controller: AbortController;
|
||||
|
||||
async function createMessage() {
|
||||
await refreshToken();
|
||||
|
||||
console.log('$conversation', $conversation);
|
||||
chatBody.artifactId = $conversation?.data?.artifactId ?? null;
|
||||
chatBody.conversationId = $conversation?.data?.$id ?? null;
|
||||
|
||||
const group = Symbol();
|
||||
if (message.startsWith('!')) {
|
||||
const [type, ...segments] = message.split(' ');
|
||||
const content = segments.join(' ');
|
||||
message = '';
|
||||
const value = `<action type="${type.replace('!', '')}">${content}</action>`;
|
||||
parser.chunk(value, 'system', {
|
||||
group
|
||||
});
|
||||
parser.chunk(value, 'system', { group });
|
||||
parser.end();
|
||||
|
||||
return;
|
||||
}
|
||||
const initialMessage = message;
|
||||
try {
|
||||
parser.chunk(message, 'user');
|
||||
firstByteReceived = false;
|
||||
message = '';
|
||||
controller = new AbortController();
|
||||
studio.streaming = true;
|
||||
const response = await fetch(
|
||||
`${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}/imagine/artifacts/${$conversation.data.artifactId}/conversations/${$conversation.data.$id}/messages`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Appwrite-Project': page.params.project,
|
||||
'X-Appwrite-Mode': 'admin'
|
||||
},
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({
|
||||
content: initialMessage,
|
||||
type: 'text'
|
||||
}),
|
||||
signal: controller.signal
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`${response.status} Error: ${await response.text()}`);
|
||||
}
|
||||
console.log('artifactId', $conversation?.data?.artifactId);
|
||||
|
||||
invalidate(Dependencies.ARTIFACTS);
|
||||
// chatIns
|
||||
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
message = '';
|
||||
|
||||
let chunk = await reader.read();
|
||||
while (!chunk.done) {
|
||||
if (!firstByteReceived) firstByteReceived = true;
|
||||
parser.chunk(decoder.decode(chunk.value), 'system', {
|
||||
group
|
||||
});
|
||||
chunk = await reader.read();
|
||||
}
|
||||
parser.end();
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
parser.chunk(error.message, 'error');
|
||||
}
|
||||
message = initialMessage;
|
||||
} finally {
|
||||
firstByteReceived = true;
|
||||
studio.streaming = false;
|
||||
}
|
||||
// const initialMessage = message;
|
||||
|
||||
// try {
|
||||
// parser.chunk(message, 'user');
|
||||
// firstByteReceived = false;
|
||||
// message = '';
|
||||
// controller = new AbortController();
|
||||
// studio.streaming = true;
|
||||
|
||||
// const url = `${sdk.forProject(page.params.region, page.params.project).client.config.endpoint}/imagine/artifacts/${$conversation.data.artifactId}/conversations/${$conversation.data.$id}/messages`;
|
||||
// const response = await fetch(
|
||||
// url,
|
||||
// {
|
||||
// method: "POST",
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'X-Appwrite-Project': page.params.project,
|
||||
// 'X-Appwrite-Mode': 'admin'
|
||||
// },
|
||||
// credentials: 'include',
|
||||
// body: JSON.stringify({
|
||||
// content: initialMessage,
|
||||
// type: 'text'
|
||||
// }),
|
||||
// signal: controller.signal
|
||||
// }
|
||||
// )
|
||||
|
||||
// const response = await fetch(
|
||||
// url,
|
||||
// {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// 'X-Appwrite-Project': page.params.project,
|
||||
// 'X-Appwrite-Mode': 'admin'
|
||||
// },
|
||||
// credentials: 'include',
|
||||
// body: JSON.stringify({
|
||||
// content: initialMessage,
|
||||
// type: 'text'
|
||||
// }),
|
||||
// signal: controller.signal
|
||||
// }
|
||||
// );
|
||||
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`${response.status} Error: ${await response.text()}`);
|
||||
// }
|
||||
|
||||
// invalidate(Dependencies.ARTIFACTS);
|
||||
|
||||
// const reader = response.body.getReader();
|
||||
// const decoder = new TextDecoder();
|
||||
|
||||
// let chunk = await reader.read();
|
||||
// while (!chunk.done) {
|
||||
// if (!firstByteReceived) firstByteReceived = true;
|
||||
// parser.chunk(decoder.decode(chunk.value), 'system', {
|
||||
// group
|
||||
// });
|
||||
// chunk = await reader.read();
|
||||
// }
|
||||
// parser.end();
|
||||
// } catch (error) {
|
||||
// if (error instanceof Error) {
|
||||
// parser.chunk(error.message, 'error');
|
||||
// }
|
||||
// message = initialMessage;
|
||||
// } finally {
|
||||
// firstByteReceived = true;
|
||||
// studio.streaming = false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
let tokens = $state(2);
|
||||
@@ -160,7 +226,7 @@
|
||||
<Divider />
|
||||
</div>
|
||||
|
||||
<Conversation {parser} thinking={!firstByteReceived} />
|
||||
<Conversation {chat} {parser} thinking={!firstByteReceived} />
|
||||
|
||||
{#if tokens < 2}
|
||||
<UpgradePrompt>
|
||||
@@ -176,6 +242,7 @@
|
||||
{/if}
|
||||
</UpgradePrompt>
|
||||
{/if}
|
||||
<Conversation {chat} {parser} thinking={chat.status === 'submitted'} />
|
||||
{/if}
|
||||
<form {onsubmit} class="input" class:minimize-chat={minimizeChat}>
|
||||
<Layout.Stack
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<script>
|
||||
import { createAIContext } from '@ai-sdk/svelte';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
createAIContext();
|
||||
// all hooks created after this or in components that are children of this component
|
||||
// will have synchronized state
|
||||
</script>
|
||||
|
||||
{@render children()}
|
||||
@@ -1,21 +1,31 @@
|
||||
<script lang="ts">
|
||||
import 'highlight.js/styles/atom-one-light.css';
|
||||
import { StreamParser } from './parser';
|
||||
import { StreamParser, type ParsedItem } from './parser';
|
||||
import { Icon, Layout, ShimmerText, Tag, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { IconArrowDown } from '@appwrite.io/pink-icons-svelte';
|
||||
import { slide } from 'svelte/transition';
|
||||
import type { UIEventHandler, WheelEventHandler } from 'svelte/elements';
|
||||
import Message from './message.svelte';
|
||||
import { studio } from '../studio.svelte';
|
||||
import { Chat } from '@ai-sdk/svelte';
|
||||
|
||||
type Props = {
|
||||
parser: StreamParser;
|
||||
autoscroll?: boolean;
|
||||
thinking?: boolean;
|
||||
chat: Chat;
|
||||
};
|
||||
let { parser, autoscroll = $bindable(true), thinking = false }: Props = $props();
|
||||
let { autoscroll = $bindable(true), thinking = false, chat }: Props = $props();
|
||||
|
||||
const chunks = parser.parsed;
|
||||
// const chunks = writable<ParsedItem[]>([
|
||||
// {
|
||||
// id: Symbol(),
|
||||
// from: 'user',
|
||||
// group: null,
|
||||
// content: "Test",
|
||||
// complete: true,
|
||||
// }
|
||||
// ]);
|
||||
|
||||
function scrollToBottom(smooth: boolean = true) {
|
||||
document
|
||||
@@ -41,13 +51,30 @@
|
||||
autoscroll = false;
|
||||
}
|
||||
};
|
||||
|
||||
$effect(() => {
|
||||
console.log("DATA", chat.data);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="overflow" {onwheel} {onscroll}>
|
||||
<section>
|
||||
{#each $chunks as message (message.id)}
|
||||
<!-- {#each $chunks as message (message.id)}
|
||||
<Message {message} />
|
||||
{/each} -->
|
||||
{#each chat.messages as message, messageIndex (messageIndex)}
|
||||
<Message
|
||||
message={{
|
||||
id: Symbol(message.id),
|
||||
from: (message.role === 'user' ? 'user' : 'assistant') as any,
|
||||
group: null,
|
||||
content: message.content,
|
||||
complete: true
|
||||
}} />
|
||||
<!-- <pre style:border="1px solid black" style:padding="1rem">{JSON.stringify(message, null, 2)}</pre> -->
|
||||
{/each}
|
||||
|
||||
{#if thinking}
|
||||
<Typography.Code size="s">
|
||||
<ShimmerText>thinking...</ShimmerText>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.imagine.listConversations(artifactId);
|
||||
if (conversations.length === 0) {
|
||||
const convo = sdk
|
||||
const convo = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.imagine.createConversation(artifactId, `Conversation ${new Date().getTime()}`);
|
||||
conversation.set(convo);
|
||||
|
||||
@@ -130,7 +130,8 @@ class Studio {
|
||||
}
|
||||
get #endpoint(): string {
|
||||
const url = new SvelteURL(this.#host);
|
||||
url.searchParams.set('workDir', `/artifact/${this.#artifact}`);
|
||||
// url.searchParams.set('workDir', `/artifact/${this.#artifact}`);
|
||||
url.searchParams.set('workDir', `/Users/arielweinberger/Development/appwrite/appwrite-console/ai-service/tmp/workspace/artifact/68681e3c002a03876050`);
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
@@ -159,4 +160,8 @@ class Studio {
|
||||
}
|
||||
}
|
||||
|
||||
export const studio = new Studio('wss://terminal.appwrite.torsten.work');
|
||||
// export const studio = new Studio('wss://terminal.appwrite.torsten.work');
|
||||
// export const studio = new Studio('ws://127.0.0.1:4000');
|
||||
export const studio = new Studio('ws://127.0.0.1:3010');
|
||||
|
||||
// POST http://127.0.0.1:4000
|
||||
|
||||
@@ -124,7 +124,9 @@ export class Synapse {
|
||||
|
||||
public async changeArtifact(endpoint: string, artifact: string, syncWorkDir: boolean = false) {
|
||||
const url = new SvelteURL(endpoint);
|
||||
url.searchParams.set('workDir', `/artifact/${artifact}`);
|
||||
// url.searchParams.set('workDir', `/artifact/${artifact}`);
|
||||
url.searchParams.set('workDir', `/Users/arielweinberger/Development/appwrite/appwrite-console/ai-service/tmp/workspace/artifact/68681e3c002a03876050`);
|
||||
|
||||
if (syncWorkDir) url.searchParams.set('syncWorkDir', 'true');
|
||||
|
||||
this.endpoint = url.toString();
|
||||
@@ -134,6 +136,7 @@ export class Synapse {
|
||||
}
|
||||
|
||||
public connect() {
|
||||
console.log("Endpoint", this.endpoint);
|
||||
this.ws = new WebSocket(this.endpoint);
|
||||
|
||||
this.ws.onopen = () => {
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
domEvent.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Key: "${key}"`);
|
||||
|
||||
synapse.dispatch(
|
||||
'terminal',
|
||||
{
|
||||
|
||||
+3
-2
@@ -13,7 +13,9 @@
|
||||
import type { EventHandler } from 'svelte/elements';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let previewUrl = new SvelteURL('https://preview.torsten.work');
|
||||
// let previewUrl = new SvelteURL('https://preview.torsten.work');
|
||||
// let previewUrl = new SvelteURL('http://localhost:1234');
|
||||
let previewUrl = new SvelteURL('http://localhost:5173');
|
||||
|
||||
let iframeRef: HTMLIFrameElement | null = $state(null);
|
||||
let iframeContainerRef: HTMLDivElement | null = $state(null);
|
||||
@@ -129,7 +131,6 @@
|
||||
iframe {
|
||||
border: none;
|
||||
position: absolute;
|
||||
background-color: red;
|
||||
|
||||
margin-inline-start: calc(-1 * var(--space-4));
|
||||
width: calc(100% + var(--space-7));
|
||||
|
||||
Reference in New Issue
Block a user